1,015 B
1,015 B
FastCollectionsByLeo
Generic
Fast HashMap
void OnStart()
{
CHashMapFast(string, int) map;
map.Add("hola", 10);
map.Add("cinco", 10);
map.Add("My key:", 20);
map.Add("Yo: ", 20);
CHashMapFastIterator(string, int) it = map.BeginIteration();
while(it.IsValid())
{
Print(it.Key(), " = ", it.Val());
it.Next();
}
}
Hash map benchmarks
- Access test over 100,000 iterations
- Converting
ENUM_TIMEFRAMES(string) to integer - Same PC used for all tests
| Class | Time (microseconds, 100,000 iterations) |
|---|---|
| Perfect Hash | ~1705 |
| CHashMapFast | 1925–1949 |
| CDictSValue | 2438–2466 |
| CHashMap | 8750–8827 |
| Linear | 9818–9869 |
Test in Final.mq5