This repository has been archived by the owner on May 5, 2024. It is now read-only.
Faster code execution with Numba and Numpy #13
Closed
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.
Hi all, I have been playing with drawing from noise using opensimplex. Sadly, is too slow if you want to compute a large picture, or a long animation.
Here I propose a patch to use the Numba jit and numpy. There are few lines changed and the improvement is very promising with a 75% speed improvement (from ~270msec to ~68msec in the benchmark below).
Old code benchmark:
PYTHONPATH=opensimplex/ python3 -m timeit 'from opensimplex import OpenSimplex; s=OpenSimplex(seed=0);
[s.noise2d(0.1, 0.1) for n in range(100000)]'
1 loop, best of 5: 278 msec per loop
Patched code benchmark:
PYTHONPATH=opensimplex/ python3 -m timeit 'from opensimplex import OpenSimplex; s=OpenSimplex(seed=0);
[s.noise2d(0.1, 0.1) for n in range(100000)]'
1 loop, best of 5: 68.7 msec per loop
Cheers from Chile!