forked from isagalaev/ijson
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use unsafe PyList APIs for improved speed
In the case of the parse basecoro, we have full control over the gen->path object, which is a list, so we can directly call a few of its PyList_* unsafe functions instead of the safer, but more expensive PySequence_* ones. In the of builder, we also can safely assume builder->value_stack is a list, and when we access items we know we are within boundaries. One of the consequences of using PyList_GET_ITEM in particular in the parse basecoro is that we now deal with borrowed references, and therefore need to do less reference tracking. This in turned simplified the CONCAT macro to the point where it became unnecessary (and it already was a bit dirty to begin with). Local benchmarks show a speed increase of ~4% in the parse method across the different test cases. Signed-off-by: Rodrigo Tobar <rtobar@icrar.org>
- Loading branch information
Showing
3 changed files
with
19 additions
and
30 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