This repository has been archived by the owner on Dec 10, 2018. It is now read-only.
Dynamically compile spec'd __init__ functions #210
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
init_func_generator()
previously used a single argument-lessinit
basefunction coupled with a
locals()
hack to build spec-aware__init__()
functions. This worked well, but profiling indicated that we were spending a
good amount of time calling
locals()
anddict.copy()
'ing its result.We now dynamically generate unique, per-spec
__init__()
functions usingcompile(..., 'exec')
. This results in much faster runtime performance at theexpense of a little compile-time complexity.
The benchmark indicates this change results in ~10% faster decoding (for both
the native and cybin implementations).
Also, because this code no longer requires version-specific code paths, it can
be moved out of _compat.py and into thrift.py.