You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JsonConverter: 5641 ms (56410µs per operation)
JsonBag: 2891 ms (28910µs per operation)
stdJSON: 7234 ms (72340µs per operation)
From these results we can see that stdJSON is significantly slower at the moment than Either Tim Hall's JSON module and JsonBag.
I think JsonBag is likely getting the performance it does by using 2 collections to store it's children data? Though this is unconfirmed. This is something that needs improving in stdJSON!
Next steps
My anticipation is that if we migrate stdJSON to use a in-class Array and HashTable (instead of IDispatch based Dictionary) this will be significantly faster than the current implementation. I.E.
JsonConverter: 4328 ms (432800µs per operation)
JsonBag: 10578 ms (1057800µs per operation)
stdJSON: 422 ms (42200µs per operation)
As we can see stdJSON is much better than the competition here, so at least we have something right. I think this is largely because both JSONConverter and JsonBag commonly use str = left(str, len(str)-1) to handle trailing commas, which when dealing with huge strings is incredibly slow! Instead we prevent the trailing commas from being in the string in the first place. Perhaps a better solution however is leave the trailing commas alone, and trim our buffer by subtracting 1 from the buffer index after the last operation...
Next steps
Consider allowing trailing commas, and removing the commas just by subtracting 1 from the buffer index.
The text was updated successfully, but these errors were encountered:
Current benchmarks
Parsing
Parsing is probably one of the most important metrics. Generally people parse json more than they do make it. So this is an important metric.
Test code
Results
From these results we can see that
stdJSON
is significantly slower at the moment than Either Tim Hall'sJSON
module andJsonBag
.I think
JsonBag
is likely getting the performance it does by using 2 collections to store it's children data? Though this is unconfirmed. This is something that needs improving instdJSON
!Next steps
My anticipation is that if we migrate
stdJSON
to use a in-class Array and HashTable (instead of IDispatch based Dictionary) this will be significantly faster than the current implementation. I.E.Stringification
For completeness, stringification is less important but is still a useful benchmark.
Test code
Results
As we can see
stdJSON
is much better than the competition here, so at least we have something right. I think this is largely because bothJSONConverter
andJsonBag
commonly usestr = left(str, len(str)-1)
to handle trailing commas, which when dealing with huge strings is incredibly slow! Instead we prevent the trailing commas from being in the string in the first place. Perhaps a better solution however is leave the trailing commas alone, and trim our buffer by subtracting 1 from the buffer index after the last operation...Next steps
Consider allowing trailing commas, and removing the commas just by subtracting 1 from the buffer index.
The text was updated successfully, but these errors were encountered: