We got a human-submitted, AI-generated PR for @pillow that claimed to speedup an internal function by 54%.

It presented no benchmark script, so I benchmarked and found no noticeable improvement.

The PR claimed the "new optimized code was tested for correctness" and offered some "Generated Regression Tests" that it declared passed.

I ran them. After fixing an import error, the tests failed for both the PR and main.

No thank you, Codeflash AI.

https://github.com/python-pillow/Pillow/pull/7915 #Python #AI #CodeflashAI

Speed up Stat._getmedian() by 54% in src/PIL/ImageStat.py by ihitamandal · Pull Request #7915 · python-pillow/Pillow

📄 Stat._getmedian() in src/PIL/ImageStat.py 📈 Performance improved by 54% (0.54x faster) ⏱️ Runtime went down from 22998.37μs to 14889.95μs Explanation and details (click to show) The function can...

GitHub