A community for discussing the Python programming language.
🌉 bridged from !python@lemmy.world by Tidepool
A community for discussing the Python programming language.
🌉 bridged from !python@lemmy.world by Tidepool
Every test can pass and your service still gets slower. Tests check correctness; they don't check...
Every test can pass and your service still gets slower. Tests check correctness; they don't check pace. A pattern for catching performance regressions before merge:
Regressions slip in quietly unless the build stops them.
Yes, a test only checks what you tell it. That was the whole argument, not a contradiction of it....
Yes, a test only checks what you tell it. That was the whole argument, not a contradiction of it. The telling is the threshold.
So the useful question is how to pick a number that isn't lazy. Run your benchmark on the same commit a handful of times and look at the spread between runs. If your timings move 4% between identical builds, a 2% gate fires on noise and everyone learns to ignore it. A 10% gate on that same codebase lets real regressions through. The threshold belongs somewhere above your measured variance and below what a regression would actually cost you.
That's also why the gate takes a baseline branch rather than just comparing to the previous run. If the previous run was itself slow, you've anchored to the problem. Comparing against the baseline branch keeps the bar fixed while the PR moves.
The gate can't decide that number for you. No tool can, because it depends on your variance and your tolerance. But a threshold picked from measured noise is the difference between a gate that means something and one that's equivalent to asserting true.
Wanted to share a Python project I've been working on, Iceberg Accounting Suite
Hello, I just wanted to share a project I've been working on using PySimpleGUI and SQLite. It's called Iceberg Accounting Suite and like the name suggests it's a double-entry bookkeeping solution and I recently added pdf invoices, making it useful to individuals and small businesses (hopefully). Right now it's only configured for dollars but im working on configuring it for any currency, stay tuned.
My apologies if this is the wrong place to share. Thanks for checking it out!
Free threaded Python is here with 3.13 beta!
Python will get true threading support with the removal of the GIL (Global Interpreter Lock) in 3.13 (now available in the beta as an experimental option). The GIL has long crippled Python's threading capabilities, but will be getting true parallelism with the implementation of PEP 703. What are you gonna do with real threads? 🤔
A harmful change can exceed your allowed performance percentage and slip straight into main — unl...
A harmful change can exceed your allowed performance percentage and slip straight into main — unless the CI job fails. Three steps that stop benchmark regressions before merge:
1️⃣ Track per project. Give each application or service you want to watch its own benchmark workspace, so the numbers stay organized.
2️⃣ Emit machine-readable results. Python: pytest-benchmark JSON output. Go: go test -bench -benchmem -json. Rust: cargo criterion --message-format=json. C++: Google Benchmark JSON exports.
3️⃣ Gate on a percentage you choose. When a change exceeds your allowed threshold, exit non-zero — that's what stops the CI job, and it gives your pull request a gate it can actually understand.
One benchmark run becomes a visible trend, and regressions stop before they merge.
What's your current threshold for a failing perf change?
TIL You can remember PIL's crop argument order as top-left xy, bottom-right xy.
It is explained in the docs as (left, up. right, bottom), which isn't too memorable. So I had to keep looking it up (autocomplete is always random with if it wants to work today or not), until I realized that (left, up, right, bottom) is just the top-left xy and bottom-right xy of the bounding box, in that order.