Even faster JSON#1104
Conversation
|
For You could cache the type of the value to avoid having to call it many times in worst-case scenerios. There is a low likelihood of |
Locally I'm seeing equal or worse performance with this change. I've tried it before and saw similar results. After this PR I'm hitting quite a wall. There's some inlining opportunities, but I'd rather avoid making the code too ugly. I think potentially some conditionals could be reordered, but that'd also be workload dependent. After that I think wins will have to be on the Luau side, or we'd have to move to a native module like simdjson/yyjson, but that seems unlikely to happen for now. |
Optimizes
@std/jsonserialization/deserialization by reducing repeated string and parsing work in hot paths:tools/dataset.jsontools/dataset.jsontools/dataset-large.jsontools/dataset-large.jsonDeserialization improved by roughly 10-15%, serialization by roughly 72-74%.
I didn't commit the json bench but may add it on, just didn't want to make the diff look huge with JSON lol.