niXman / yas

Yet Another Serialization
731 stars 95 forks source link

json compliance #150

Closed masbug closed 11 months ago

masbug commented 11 months ago

Hi, I was just wondering what exactly is non-compliant with your json serialization/deserialization? Thanks for the answer.

niXman commented 11 months ago

hi,

hmm.. that text was written at 2016-2017 and perhaps something was not completed at that time...

masbug commented 11 months ago

Thanks for a great library! It's insanely fast compared to others. Here are my tests on an IMX6UL (opt. O2):

Written/read: 10x vector of 1000 data structures
---------------------------------------------------------------------------
Benchmark                                             Time             CPU 
---------------------------------------------------------------------------
---------------------------------------------------------------------------
JSON serialization
---------------------------------------------------------------------------
BM_QtSerialize<V>/1000/10                          6091 ms         4804 ms 
BM_QtDeserialize<V>/1000/10                        2849 ms         2259 ms 

// with std::map
BM_nlohmann_Serialize<V, AsJSON>/1000/10           1083 ms          835 ms 
BM_nlohmann_Deserialize<V, AsJSON>/1000/10         1736 ms         1374 ms 

// with ankerl_map & std::hash
BM_nlohmann_Serialize<V, AsJSON>/1000/10            978 ms          754 ms 
BM_nlohmann_Deserialize<V, AsJSON>/1000/10         1550 ms         1222 ms 

// without events
BM_taoJSON_Serialize<false>/1000/10                2747 ms         2227 ms 
BM_taoJSON_Deserialize<false>/1000/10              1073 ms          803 ms 
// using events
BM_taoJSON_Serialize<true>/1000/10                 2172 ms         1785 ms 
BM_taoJSON_Deserialize<true>/1000/10                470 ms          378 ms 

BM_cereal_Serialize<AsJSON>/1000/10                1517 ms         1217 ms
BM_cereal_Deserialize<AsJSON>/1000/10              1038 ms          831 ms

BM_yas_Serialize<V,yas::json>/1000/10               245 ms          192 ms
BM_yas_Deserialize<V,yas::json>/1000/10             235 ms          188 ms

---------------------------------------------------------------------------
Binary serialization
---------------------------------------------------------------------------
// nlohmann
BM_nlohmann_Serialize<V, AsBSON>/1000/10            830 ms          639 ms
BM_nlohmann_Deserialize<V, AsBSON>/1000/10         1286 ms          984 ms
BM_nlohmann_Serialize<V, AsBJData>/1000/10          715 ms          549 ms
BM_nlohmann_Deserialize<V, AsBJData>/1000/10       1418 ms         1095 ms
BM_nlohmann_Serialize<V, AsCBOR>/1000/10            850 ms          657 ms
BM_nlohmann_Deserialize<V, AsCBOR>/1000/10         1331 ms         1031 ms
BM_nlohmann_Serialize<V, AsUBJSON>/1000/10          718 ms          552 ms
BM_nlohmann_Deserialize<V, AsUBJSON>/1000/10       1397 ms         1084 ms

BM_Protobuf_Serialize/1000/10                      23.4 ms         17.5 ms 
BM_Protobuf_Deserialize/1000/10                    44.2 ms         33.4 ms 

BM_cereal_Serialize<AsBinary>/1000/10              37.7 ms         28.9 ms
BM_cereal_Deserialize<AsBinary>/1000/10            33.0 ms         25.5 ms

// SerializationFixture
BM_sf_Serialize<V>/1000/10                         39.9 ms         30.5 ms
BM_sf_Deserialize<V>/1000/10                       16.7 ms         12.8 ms

BM_yas_Serialize<V,yas::binary>/1000/10            13.7 ms         9.95 ms
BM_yas_Deserialize<V,yas::binary>/1000/10          7.04 ms         5.29 ms
---------------------------------------------------------------------------
niXman commented 11 months ago

could you provide a link to the benchmark please? just for the history =)

and yes, YAS-JSON is very fast!