MQLArticles/Utils/Dict/Ben.mq5
2026-04-09 15:46:28 -05:00

57 行
1.7 KiB
MQL5

//+------------------------------------------------------------------+
//| Ben.mq5 |
//| Copyright 2026,Niquel Mendoza. |
//| https://www.mql5.com/en/users/nique_372 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026,Niquel Mendoza."
#property link "https://www.mql5.com/en/users/nique_372"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#include "Main.mqh"
#include "..\\FA\\FuncionesBases.mqh"
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
const int total = 100000;
//---
CDict dict;
dict.Set("hola", 10);
ulong ant = GetMicrosecondCount();
for(int i = 0; i < total; i++)
{
int v;
dict.TryGetAs("hola", v);
}
ulong dsp = GetMicrosecondCount() - ant;
Print("Dict: ", dsp);
//---
CHashMap<string, int> hashmap;
hashmap.Add("hola", 10);
ant = GetMicrosecondCount();
for(int i = 0; i < total; i++)
{
int v;
hashmap.TryGetValue("hola", v);
}
dsp = GetMicrosecondCount() - ant;
Print("Hashmap: ", dsp);
//---
/*
2026.04.09 15:38:43.279 Ben (EURUSD,H1) Dict: 1037
2026.04.09 15:38:43.284 Ben (EURUSD,H1) Hashmap: 4450
*/
}
//+------------------------------------------------------------------+