This repository has been archived by the owner on Jan 13, 2023. It is now read-only.
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.
Resolves #161
This adds an optional C extension for the
kerl
functionality. It can be installed by itself withpip install kerl
but I've updated thesetup.py
so that it can also be installed withpip install pyota[kerl]
. Additionally I created a group for both C extensions so that one can dopip install pyota[speedups]
.When creating the extension I changed the names of
convertToTrits
andconvertToBytes
tobytes_to_trits
andtrits_to_bytes
. I thought these names were more descriptive and I don't think this should affect anyone as I don't imagine many (if any) people were importing these names.Finally, the numbers...
I used the following script as my benchmark:
With the python implementation, it takes me 4.759015798568726 seconds. Using the C extension, it takes 0.9080002307891846 seconds (over five times faster).
Just for fun, I also timed how long it takes to run the tests with both versions. Under the python version it takes 112.564s while the C extension takes 72.736s.