JsonParserByLeo/Test/Ben.mq5
Nique_372 435f93a426
2026-06-03 08:51:42 -05:00

60 lines
1.9 KiB
MQL5

//+------------------------------------------------------------------+
//| Ben.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 "..\\..\\fast_json\\fast_json.mqh"
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#include "..\\Src\\JsonNode.mqh"
#resource "twitter.json" as const string g_json_data
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
TSN::CJsonParser parser;
// Only one copy
parser.Assing(g_json_data);
uint a = GetTickCount();
for(int i = 0; i < 1000; i++)
{
parser.Parse();
}
uint b = GetTickCount() - a;
Print("Time: ", b);
//---
CJson json;
// Only one copy
StringToCharArray(g_json_data, json.ctx.buffer);
a = GetTickCount();
for(int i = 0; i < 1000; i++)
{
json.ParseData();
}
b = GetTickCount() - a;
Print("Time: ", b);
//---
/*
2026.06.03 08:51:12.467 Ben (EURUSD,M1) Time: 1094
2026.06.03 08:51:13.736 Ben (EURUSD,M1) Time: 1265
*/
}
//+------------------------------------------------------------------+