-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance playground #183
Performance playground #183
Conversation
This is slower, and it's better if we can avoid it anyways. This reverts commit 08821c0.
Note that .raw is currently broken in this implementation.
Looks promising! I agree, Cython is probably the easiest to use and if it's the fastest as well we can focus on that. Also, I think we can make things even simpler by always converting slices to three Lastly, I think I figured out why ndindex is downloaded so many times: It's used in python-blosc2! |
You can only eliminate None from a slice if you know the array shape (i.e. call reduce() with shape). And anyways it's an intentional design decision to not do any sort of canonicalization in the constructors, which I'd like to maintain. |
This is much simpler than trying to work around GitHub Actions not having a great way for actions to depend on each other.
Dev Cython is breaking the coverage reporting in the tests. The purpose of the build is only to test dev NumPy. Maybe testing dev Cython (and others) would be useful in the future, but for now this is breaking this CI.
This is ready to go, if anyone wants to do a final review. Otherwise, I plan to do a release later this week. Hopefully it will go smoothly. The release process did get updated because we are now building wheels. |
Looking into improving the performance of ndindex by creating an extension module (#181).
Since one of the biggest performance issues right now is the overhead of type checking when creating new objects, I've focused on this for now. This should also give the best idea of what the various options will look like in terms of maintainability.
I've created a Python file
simple_slice
which contains an objectSimpleSlice
that does type checking and nothing else. I've also createdsimple_slice_cython
,simple_slice_pybind11
, andsimple_slice_rust
.I picked Slice because
To compile, run
and
you can then run the tests with
and the benchmarks with
On my machine, this is the result of the benchmarks:
Most of this code was generated by Claude/ChatGPT.
I still need to investigate whether more optimizations can be made in these implementations. I will say so far that:
raw
method is still wrong), and I gave up getting them to do any sorts of optimizations. So I'm sure there probably are optimizations that can be made here. However, unless someone can give some good arguments why I should stick with Rust, I'm not really feeling it is a good option.For instance, in Cython there is a
has_stop
, trick to avoid None which can probably be used in C++ and Rust to allow the arguments to be typed as integers.I will play around with this some more next week, and maybe also look at how some methods like
reduce
oras_subindex
can be improved.Another question that needs to be looked at is how much I can get away with compiling only critical stuff and leaving the rest in Python, and how easy these different implementations make doing that.
@peytondmurray @ArvidJB