Skip to content

Optimize orient_pixels performance by replacing np.rot90 with manual slicing and swapaxes.#350

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_936710812
Jun 23, 2026
Merged

Optimize orient_pixels performance by replacing np.rot90 with manual slicing and swapaxes.#350
copybara-service[bot] merged 1 commit into
mainfrom
test_936710812

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Jun 23, 2026

Copy link
Copy Markdown

Optimize orient_pixels performance by replacing np.rot90 with manual 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)

…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
@copybara-service copybara-service Bot merged commit 9d90319 into main Jun 23, 2026
@copybara-service copybara-service Bot deleted the test_936710812 branch June 23, 2026 16:36
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.

1 participant