Repository navigation
Do not lazily import olefile - #10213
Conversation
Merging this PR will degrade performance by 11.52%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | test_draw_lines_blend[1237x811-0] |
1 ms | 1.2 ms | -11.59% |
| ❌ | test_draw_lines_blend[1237x811-255] |
1 ms | 1.2 ms | -11.52% |
| ❌ | test_draw_lines_blend[1237x811-127] |
1 ms | 1.2 ms | -11.44% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing radarhere:lazy (fb2c298) with main (bc7e6f5)2
Footnotes
-
338 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. ↩
-
No successful run was found on
main(964d7bc) during the generation of this report, so bc7e6f5 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
#9733 added lazy imports, a new feature of Python 3.15.
However, https://docs.python.org/3.15/reference/simple_stmts.html#lazy
If there is going to be an import error, I don't think this plays well with our expectation that an
ImportErrorwould prevent MicImagePlugin from registering its format.Pillow/src/PIL/Image.py
Lines 488 to 492 in 964d7bc
Pillow/src/PIL/MicImagePlugin.py
Lines 20 to 22 in 964d7bc
Pillow/src/PIL/MicImagePlugin.py
Line 105 in 964d7bc
The unexpected failure that results can be seen at https://github.com/python-pillow/Pillow/actions/runs/38696429958/job/116294282528
My suggestion is that we don't lazily import
olefile. I think that is the only optional module that we are lazily importing.