59 lines
2.2 KiB
MQL5
59 lines
2.2 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| NodeAcces.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 "..\\..\\Src\\JsonNode.mqh"
|
|
#include "..\\..\\..\\Xoshiro256\\Xoshiro256.mqh"
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
#resource "test.json" as const string g_json_test
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Script program start function |
|
|
//+------------------------------------------------------------------+
|
|
void OnStart()
|
|
{
|
|
//---
|
|
TSN::CJsonParser parser;
|
|
parser.Assing(g_json_test);
|
|
parser.Parse();
|
|
TSN::CJsonNode root = parser.GetRoot();
|
|
|
|
//root["valores"].NodeHashing();
|
|
string keys[];
|
|
const int n = root["valores"].GetKeys(keys);
|
|
|
|
Xoshiro256 xo;
|
|
xo.Seed(156015641);
|
|
|
|
//--- Prueba 1 acceso a valor..
|
|
ulong a = GetMicrosecondCount();
|
|
for(int i = 0; i < 1000; i++)
|
|
{
|
|
const string key = keys[xo.RandomInteger(0, n)];
|
|
root["valores"][key];
|
|
}
|
|
ulong b = GetMicrosecondCount() - a;
|
|
Print("First prueba: ", b);
|
|
|
|
/*
|
|
2026.06.28 18:33:03.416 NodeAcces (EURUSD,H1) First prueba: 162
|
|
2026.06.28 18:33:04.116 NodeAcces (EURUSD,H1) First prueba: 163
|
|
2026.06.28 18:33:05.671 NodeAcces (EURUSD,H1) First prueba: 161
|
|
2026.06.28 18:33:06.323 NodeAcces (EURUSD,H1) First prueba: 163
|
|
2026.06.28 18:33:07.467 NodeAcces (EURUSD,H1) First prueba: 162
|
|
2026.06.28 18:33:08.311 NodeAcces (EURUSD,H1) First prueba: 161
|
|
*/
|
|
}
|
|
//+------------------------------------------------------------------+
|