-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR improves the speed of JSON parsing with the `string_parser` module. The new version of `parse_json_string` is heavily inspired by Python's implementation, available [here](https://github.com/python/cpython/blob/master/Modules/_json.c) Time is usually either as performing as before or better, Valgrind also gives the new version an advantage, sometimes significant. On `large_escaped` (~120M, lots of escaped characters), we have: * Before: 13 748 436 458 Ir * After: 11 687 104 643 Ir i.e. an improvement of ~18% Time is: * Before: 0m4.428s * After: 0m3.932s i.e. an improvement of ~13% Note that on this particular test, although the number of allocations is limited as much as we can, Boehm still cannibalizes the runtime, seeing that the real time is ~2.6s. Perf gives a total time of ~38% in GC_mark and ~7% in GC_cache_miss. Some more optimizations can be thought, but this shows how important a good GC is necessary for the future, this program can be a good metric of how GC usage can be improved. For further reference, Python3 on the same test gives the following output on time and Valgrind: * Time (user): 0m1.760s * Time (real): 0m2.177s * Valgrind: 8 845 966 867 Ir Pull-Request: #2058 Reviewed-by: Jean Privat <[email protected]>
- Loading branch information
Showing
4 changed files
with
171 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters