CPU optimization of model/json#503
Conversation
|
Hey @imix, This is great, love to see a contribution like this. |
|
Hey @imix, Could I ask you to separate the JSON change into a new PR please? Otherwise it's looking good |
This reverts commit b4df66d.
|
Hi @TomWright I reverted the json library in this PR. I will create a second PR with the json library |
|
I've pulled in new tests for the |
|
I've adjusted the code - it can still likely be improved since we still use
21.4s
14.7s I'll merge this here but of course welcome any further improvements. Thanks for the contribution. |
|
Great to see you could implement it! I did not find other big optimization areas so far. Maybe I have a look at Profile-guided optimization if I find the time. |
Hi
I tried some optimization techniques on dasel and got some improvements.
One of the improvement stems from switching the json library which is maybe not desired. Nevertheless I left the other json library in the pull request to illustrate the potential.
My benchmark was as follows:
cat citylots.json | ./main_orig -i json "features.map(properties.MAPBLKLOT)"
with this json: https://github.com/zemirco/sf-city-lots-json
The version I started with measured as follows (using hyperfine):
Benchmark 1: ./test.sh
Time (mean ± σ): 17.369 s ± 0.032 s [User: 38.968 s, System: 1.464 s]
Range (min … max): 17.324 s … 17.422 s 10 runs
The optimized version had these results:
Benchmark 1: ./test.sh
Time (mean ± σ): 8.440 s ± 0.016 s [User: 14.793 s, System: 1.105 s]
Range (min … max): 8.417 s … 8.472 s 10 runs
Hope this helps or at least gives some insights.