Libraries: MQL4/5-JsonLib - page 3

 
Alain Verleyen #:
This one is a lot faster
The improvement in speed is thanks to fxsaber's suggestion.
 
Alain Verleyen #:

Comparison of this library with the old JASon, with a data file of 100 MB

2025.12.20 12:47:28.234    jason_bench (EURUSD,H1)    JASon Example Deserialization:
2025.12.20 12:47:50.302    jason_bench (EURUSD,H1)    Deserialize 107652093 bytes JSON in 22020713 microseconds. 
2025.12.20 12:47:50.302    jason_bench (EURUSD,H1)    Check value = Richard Sullivan
2025.12.20 12:47:50.302    jason_bench (EURUSD,H1)    Terminal memory used =2023, MQL memory used = 1958 MB

2025.12.20 12:47:53.007    JsonLib_bench (EURUSD,H1)    ====== MQL5 JSON Library - Bench parsing ======
2025.12.20 12:47:54.601    JsonLib_bench (EURUSD,H1)    Deserialize 107652093 characters JSON in 1461365 microseconds. 
2025.12.20 12:47:54.601    JsonLib_bench (EURUSD,H1)    Check value = Richard Sullivan
2025.12.20 12:47:54.601    JsonLib_bench (EURUSD,H1)    Terminal memory used =4987, MQL memory used = 4879 MB

This one is a lot faster but is using 2.5 times more memory. 

toysjon library.

Example.

MQL5 Book: Signal service client program in MQL5 / Advanced language tools
MQL5 Book: Signal service client program in MQL5 / Advanced language tools
  • www.mql5.com
So, according to our decision, the text in the service messages will be in JSON format. In the most common version, JSON is a text description of...
 

The latest update is here:

Forum on trading, automated trading systems and testing trading strategies

Experts: MQL5 Programming for Traders – Source Codes from the Book. Part 7

Stanislav Korotky, 2025.07.05 20:02

Here is yet another minor bugfix in ToyJson3.mqh - floating point numbers with exponent (scientific notation, like "1e-8") are now detected correctly during parsing.
 
2025.12.20 17:46:37.979    toyjson_bench (EURUSD,H1)    ====== toyjson3 - Bench parsing ======
2025.12.20 17:46:39.187    toyjson_bench (EURUSD,H1)    Deserialize 107652093 bytes JSON in 1101111 microseconds. 
2025.12.20 17:46:39.187    toyjson_bench (EURUSD,H1)    Check value = "Richard Sullivan"
2025.12.20 17:46:39.187    toyjson_bench (EURUSD,H1)    Terminal memory used =2738, MQL memory used = 2493 MB
Better.
 
hini #:
Thank you for testing. This library has a streaming JSON parsing feature. Using this feature, memory usage should be minimal, but I'm not sure if the speed will decrease, as I haven't conducted thorough testing.
I checked, doesn't memorize all the data, so it could be interesting to get what you need "on the fly".
 
Alain Verleyen #:
2025.12.20 17:46:37.979    toyjson_bench (EURUSD,H1)    ====== toyjson3 - Bench parsing ======
2025.12.20 17:46:39.187    toyjson_bench (EURUSD,H1)    Deserialize 107652093 bytes JSON in 1101111 microseconds. 
2025.12.20 17:46:39.187    toyjson_bench (EURUSD,H1)    Check value = "Richard Sullivan"
2025.12.20 17:46:39.187    toyjson_bench (EURUSD,H1)    Terminal memory used =2738, MQL memory used = 2493 MB
Better.
 
fxsaber #:

2026.02.17 08:30:32.163    toyjson_bench (GBPAUD,H4)    ====== toyjson3 - Bench parsing ======
2026.02.17 08:30:33.507    toyjson_bench (GBPAUD,H4)    Deserialize 107652093 bytes JSON in 1111794 microseconds. 
2026.02.17 08:30:33.507    toyjson_bench (GBPAUD,H4)    Check value = "Richard Sullivan"
2026.02.17 08:30:33.507    toyjson_bench (GBPAUD,H4)    Terminal memory used =2682, MQL memory used = 2493 MB

2026.02.17 08:42:22.467    fast_json_bench (GBPAUD,H4)    ====== fast_json - Bench parsing ======
2026.02.17 08:42:22.733    fast_json_bench (GBPAUD,H4)    Deserialize 107652093 bytes JSON in 81625 microseconds. 
2026.02.17 08:42:22.733    fast_json_bench (GBPAUD,H4)    Check value = Richard Sullivan
2026.02.17 08:42:22.733    fast_json_bench (GBPAUD,H4)    Terminal memory used =1745, MQL memory used = 1746 MB

A lot faster.
 

Forum on trading, automated trading systems and testing trading strategies

Libraries: MQL4/5-JsonLib

fxsaber, 2025.12.20 07:39

template <typename T>
bool IsInteger( const T s )
{
//  return((s != '.') && (s != 'e') && (s != 'E'));
  return((s != '.') && (s <= '9'));
}


Better.

Fórum de negociação, sistemas de negociação automatizados e testes de estratégias de negociação

Bibliotecas: JSON Library for LLMs

fxsaber, 2026.02.19 08:14

bool IsDigit( const uchar Char )
{
  return((bool)(Char & (1 << 4)));
}
 
fxsaber #:


Better.

👍👍👍