Apply hoist optimizations to Geometry.c's transforms - #9788
Conversation
Merging this PR will improve performance by 14.43%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | test_rotate_right[1024x1024-L-ROTATE_180] |
4.5 ms | 3.6 ms | +24.05% |
| ⚡ | test_rotate_right[1024x1024-L-FLIP_LEFT_RIGHT] |
4.5 ms | 3.6 ms | +24.05% |
| ⚡ | test_rotate_right[1024x1024-LA-ROTATE_180] |
7.4 ms | 6.5 ms | +13.45% |
| ⚡ | test_rotate_right[1024x1024-RGBA-ROTATE_180] |
7.4 ms | 6.5 ms | +13.44% |
| ⚡ | test_rotate_right[1024x1024-RGBA-FLIP_LEFT_RIGHT] |
7.4 ms | 6.5 ms | +13.44% |
| ⚡ | test_rotate_right[1024x1024-LA-FLIP_LEFT_RIGHT] |
7.4 ms | 6.5 ms | +13.44% |
| ⚡ | test_rotate_right[1024x1024-RGB-ROTATE_180] |
7.4 ms | 6.5 ms | +13.44% |
| ⚡ | test_rotate_right[1024x1024-RGB-FLIP_LEFT_RIGHT] |
7.4 ms | 6.5 ms | +13.44% |
| ⚡ | test_scale[1024x1024-RGB-2.14-NEAREST] |
37.5 ms | 33.5 ms | +11.98% |
| ⚡ | test_scale[1024x1024-RGBA-2.14-NEAREST] |
37.5 ms | 33.5 ms | +11.95% |
| ⚡ | test_scale[1024x1024-LA-2.14-NEAREST] |
37.5 ms | 33.5 ms | +11.95% |
| ⚡ | test_scale[1024x1024-F-2.14-NEAREST] |
37.5 ms | 33.5 ms | +11.94% |
| ⚡ | test_scale[1024x1024-I-2.14-NEAREST] |
37.5 ms | 33.5 ms | +11.92% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing akx:faster-geometry-1 (1a8290d) with main (8f86212)
Footnotes
-
2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
| int in_xsize = imIn->xsize, in_ysize = imIn->ysize; | ||
| int out_xsize = imOut->xsize, out_ysize = imOut->ysize; | ||
|
|
||
| if (in_xsize != out_xsize || in_ysize != out_ysize) { |
There was a problem hiding this comment.
Could you explain how this is an improvement? I mean, it wasn't using the values within a loop. There was no repetition at all.
Like the other recent optimization PRs: hoist
im*->xsizeandim*->ysizeinto locals so autovectorization can do its thing.