Optimize orient_pixels performance by replacing np.rot90 with manual slicing and swapaxes.#350
Merged
Merged
Conversation
1d835c1 to
88bd430
Compare
…slicing and swapaxes. Benchmark results (local runs, n=10): | name | old time/op | new time/op | delta | | :--- | :--- | :--- | :--- | | OrientPixels_320x480_rot1_view | 9.47µs ± 3% | 0.84µs ± 8% | -91.15% (p=0.000 n=10) | | OrientPixels_320x480_rot2_view | 7.15µs ± 2% | 0.55µs ± 18% | -92.25% (p=0.000 n=10) | | OrientPixels_320x480_rot3_view | 9.36µs ± 3% | 0.80µs ± 9% | -91.49% (p=0.000 n=10) | | OrientPixels_1080x1920_rot1_view | 9.39µs ± 1% | 0.73µs ± 8% | -92.23% (p=0.000 n=10) | | OrientPixels_1080x1920_rot2_view | 7.14µs ± 5% | 0.57µs ± 9% | -92.08% (p=0.000 n=10) | | OrientPixels_1080x1920_rot3_view | 9.36µs ± 1% | 0.77µs ± 8% | -91.79% (p=0.000 n=10) | | OrientPixels_320x480_rot1_copy | 795µs ± 1% | 772µs ± 1% | -2.84% (p=0.000 n=10) | | OrientPixels_320x480_rot2_copy | 789µs ± 3% | 766µs ± 1% | -2.97% (p=0.000 n=10) | | OrientPixels_320x480_rot3_copy | 797µs ± 3% | 769µs ± 1% | -3.56% (p=0.000 n=10) | PiperOrigin-RevId: 936720087
88bd430 to
9d90319
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Optimize orient_pixels performance by replacing np.rot90 with manual slicing and swapaxes.
Benchmark results (local runs, n=10):