geforkt von nique_372/TSNStd
74 Zeilen
2,1 KiB
MQL5
74 Zeilen
2,1 KiB
MQL5
//+------------------------------------------------------------------+
| |
//| Test.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 "..\\Conv.mqh"
| |
| |
//+------------------------------------------------------------------+
| |
//| Script program start function |
| |
//+------------------------------------------------------------------+
| |
void OnStart()
| |
{
| |
//---
| |
long v = 0;
| |
ulong tsn = 0, tsn_min = ULONG_MAX;
| |
ulong native = 0, nat_min = ULONG_MAX;
| |
| |
//---
| |
for(int rep = 0; rep < 32; rep++)
| |
{
| |
for(int j = 0; j < 2; j++)
| |
{
| |
const bool y = j % 2 == 0;
| |
| |
//---
| |
ulong a = GetMicrosecondCount();
| |
if(y)
| |
{
| |
for(int i = 1; i < (1 << 30); i += 1000)
| |
{
| |
const string str = string(i);
| |
int pos = 0;
| |
TSN::CStringConvert::ToValueNSigned(str, pos, v, StringLen(str));
| |
}
| |
}
| |
else
| |
{
| |
for(int i = 1; i < (1 << 30); i += 1000)
| |
{
| |
const string str = string(i);
| |
v = StringToInteger(str);
| |
}
| |
}
| |
ulong b = GetMicrosecondCount() - a;
| |
| |
//---
| |
if(y)
| |
{
| |
tsn += b;
| |
if(b < tsn_min)
| |
tsn_min = b;
| |
}
| |
else
| |
{
| |
native += b;
| |
if(b < nat_min)
| |
nat_min = b;
| |
}
| |
}
| |
}
| |
| |
//---
| |
Print("tsn: ", tsn, " ch: ", v, " min: ", tsn_min);
| |
Print("native: ", native, " ch: ", v, " min: ", nat_min);
| |
}
| |
//+------------------------------------------------------------------+
|