Adding Metering to Small Python
Today is another day of me staying completely outside my home office. I enjoyed a short road trip, dined on Chicken Alexander, and watched my wife play chess with my son (he won in the end with a promotion). Meanwhile, Claude Code kept running, and as of writing, it is still running. Wow. What an entire day!
What it’s working on is a metering feature for Small Python, which is essential for the upcoming sandbox features.
A traditional language wouldn’t pay much attention to this feature, because its programs are supposed to run as long as possible, like server applications or GUI applications. Small Python is different. It is intended to be embedded or run by agents, so being metered is essential: the host application must be able to stop the code if it eats too much.
The current design is pretty much aligned with QuickJS. It introduces meters over running steps and memory, so that code like while True: pass won’t run forever.
A fun thing I observed during the run is that it often reverts its changes or keeps refactoring. That’s because I have a rule: optimize or revert if the benchmark shows degradation. It even reverted once because of a +0.01% performance loss that it couldn’t find a way to work around. I feel I may be too harsh, and I doubt I could do it myself, but Opus 5.5 did it pretty well.
As the sessions went on, I gained more confidence. It’s not just passing the tests, the fuzzing, the formal verification, and the benchmarks. It’s how it gets there: it’s showing the characteristics of a C programmer with 30 years of experience.