JsonParserByLeo/Test/Ben/BenJsonLib.mq5
2026-06-28 18:47:50 -05:00

52 行
无行尾
1.9 KiB
MQL5

//+------------------------------------------------------------------+
//| BenJsonLib.mq5 |
//| Copyright 2026, Niquel Mendoza. |
//| https://www.mql5.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, Niquel Mendoza."
#property link "https://www.mql5.com/"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#include <JsonLib\\JsonLib.mqh>
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#resource "twitter.json" as const string g_json_data
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
MQL5_Json::JsonError error;
MQL5_Json::JsonParseOptions opts;
opts.engine = MQL5_Json::ENGINE_HIGH_SPEED;
//---
MQL5_Json::Internal::CJsonRapidParser rapid_parser;
rapid_parser.m_text = g_json_data; // one copy
rapid_parser.m_text_len = StringLen(g_json_data);
//---
Sleep(1000);
//---
ulong a = GetMicrosecondCount();
for(int i = 0; i < 1000; i++)
{
rapid_parser.ParseToTapeFast(opts, error);
}
ulong b = GetMicrosecondCount() - a;
Print("TIme: ", b);
}
//+------------------------------------------------------------------+
/*
2026.06.26 20:58:02.848 BenJsonLib (EURUSD,MN1) TIme: 2145021
2026.06.26 20:58:09.638 BenJsonLib (EURUSD,MN1) TIme: 2163666
*/