//+------------------------------------------------------------------+ //| 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 "BitFastBuffer.mqh" //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- struct Frame { string symbol; ENUM_TIMEFRAMES tf; int index; long rand; ENUM_APPLIED_PRICE appled; }; TSN::CBitBuffer bit(28); //--- MathSrand(20); //--- Frame data[20]; for(int i = 0; i < 20; i++) { data[i].symbol = string(MathRand()); data[i].tf = ENUM_TIMEFRAMES(i); data[i].index = i; data[i].rand = MathRand(); data[i].appled = ENUM_APPLIED_PRICE(i & 3); } //--- string buffer = ""; MathSrand(20); ulong a = GetMicrosecondCount(); for(int i = 0; i < 100000; i++) { const int idx = (MathRand() % 5); buffer = data[idx].symbol + string(int(data[idx].tf)) + string(data[idx].index) + string(data[idx].rand) + string(int(data[idx].appled)); } ulong b = GetMicrosecondCount(); Print("time: ", (b - a), " b: ", buffer[0]); //--- MathSrand(20); a = GetMicrosecondCount(); for(int i = 0; i < 100000; i++) { const int idx = (MathRand() % 5); bit.Clear(); bit.WriteStringWPadd(data[idx].symbol); bit.WriteInteger(data[idx].tf); bit.WriteInteger(data[idx].index); bit.WriteInteger(data[idx].rand); bit.WriteInteger(data[idx].appled); } b = GetMicrosecondCount(); Print("time: ", (b - a), " b: ", bit.m_bits[0]); /* 2026.09.03 20:15:44.028 Ben (EURUSD,H1) time: 16615 b: 49 2026.09.03 20:15:44.031 Ben (EURUSD,H1) time: 2858 b: 3354673 2026.09.03 20:15:44.661 Ben (EURUSD,H1) time: 16442 b: 49 2026.09.03 20:15:44.664 Ben (EURUSD,H1) time: 2855 b: 3354673 */ } //+------------------------------------------------------------------+