Skip to content
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

Avoid the use of stride tricks to make code more readable #89

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hmaarrfk
Copy link
Contributor

@hmaarrfk hmaarrfk commented Jul 7, 2024

Admittedly this is a style issue, but I feel like stridetricks isn't very useful in this particular case and it somewhat destroys readability for me.

While the reshaping is cute, I honestly don't think it helps much with the python overhead.

I hit this code in trying to implment frustum culling for my application (though I still haven't succeeded in getting a performance improvement).

Let me know what you think.

I think there is also some complexity in the code due to an attempt at making it generaizable to beyond a single "aabb" object.

However, I didn't see any tests for this, and so my presumption is that this is problem and likely the cause of much of the original code compelxity.

Admittedly this is a style issue, but I feel like stridetricks isn't
very useful in this particular case and it somewhat destroys readability
for me.

While the reshaping is cute, I honestly don't think it helps much with
the python overhead.

I hit this code in trying to implment frustum culling for my application
(though I still haven't succeeded in getting a performance improvement).

Let me know what you think.

I think there is also some complexity in the code due to an attempt at
making it generaizable to beyond a single "aabb" object.

However, I didn't see any tests for this, and so my presumption is that
this is problem and likely the cause of much of the original code
compelxity.
@hmaarrfk hmaarrfk requested a review from Korijn as a code owner July 7, 2024 19:00
@almarklein
Copy link
Member

I think there is also some complexity in the code due to an attempt at making it generaizable to beyond a single "aabb" object.

Yes, (almost) all functions in pylinalg are meant to also work on batches (i.e. arrays) of objects. That ability provides a big performance benefit in cases where multiple objects must be transformed. If the test for that is missing for this function, we should probably add that too, to make sure the changes don't break that ability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants