JsonParserByLeo/Test/Ben/BenO.mq5
2026-07-19 13:56:15 -05:00

58 行
1.8 KiB
MQL5

//+------------------------------------------------------------------+
//| BenO.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 "..\\Other\\CJsonNode.mqh"
#include <JAson.mqh>
#resource "twitter.json" as const string g_json_data
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
CJsonNode json_n;
json_n.__bjson = g_json_data; // One copy
uint a = GetTickCount();
for(int i = 0; i < 100; i++)
{
json_n.ParseString();
}
uint b = GetTickCount() - a;
Print("Time JsonNode: ", b);
//---
CJAVal js(NULL, jtUNDEF);
char data[];
StringToCharArray(g_json_data, data); // One copy
a = GetTickCount();
for(int i = 0; i < 100; i++)
{
js.Deserialize(data);
}
b = GetTickCount() - a;
Print("Time JAson: ", b);
/*
2026.06.26 18:15:52.020 BenO (EURUSD,MN1) Time JsonNode: 7672
2026.06.26 18:15:54.040 BenO (EURUSD,MN1) Time JAson: 1922
2026.06.26 18:16:04.924 BenO (EURUSD,MN1) Time JsonNode: 8047
2026.06.26 18:16:06.958 BenO (EURUSD,MN1) Time JAson: 1907
*/
}
//+------------------------------------------------------------------+