Making ast.walk 220x Faster
palashawas
104 points
17 comments
June 16, 2026
Related Discussions
Found 5 related stories in 113.9ms across 10,715 title embeddings via pgvector HNSW
- Even faster asin() was staring right at me def-pri-pub · 107 pts · March 16, 2026 · 47% similar
- Accelerate – Embedded language for high-performance array computations tosh · 82 pts · May 16, 2026 · 46% similar
- Show HN: LiteParse v2, now in Rust 100x faster pierre · 11 pts · May 28, 2026 · 46% similar
- Optimizing Ruby Path Methods weaksauce · 76 pts · April 18, 2026 · 46% similar
- Faster asin() was hiding in plain sight def-pri-pub · 185 pts · March 11, 2026 · 46% similar
Discussion Highlights (7 comments)
westurner
Could this ast.sprint ast.walk optimization make libCST or bandit faster? https://news.ycombinator.com/item?id=39111747 libCST: https://github.com/Instagram/LibCST bandit: https://github.com/PyCQA/bandit Links to codemod tools; "Baby Steps into Genetic Programming" https://news.ycombinator.com/item?id=43617655
eska
I appreciate that you first tried to optimize the original Python code. Idiomatic Python is unfortunately disappointingly slow and not so interesting to compare to.
fwip
I wonder if these lints could have been expressed as semgrep rules?
bionhoward
It’s amazing how much Python punishes you for modularizing your code
ozgrakkurt
"AI reflex-app builder" slop alert
anitil
I really enjoy making Python faster. I feel like the sweet spot for me is proving a concept with the dumbest possible implementation to show that something would work, and then using that as a comparison implementation to prove that later improvements match the results of the dumb, obviously correct implementation.
teo_zero
The second part, where it says that Rust is faster than Python, is so obvious than doesn't deserve any further comments. What I found interesting, is that idiomatic Python, with generators and all, can be so much worse than "C-style" Python, if you will pardon that term. It's a pity many kids are taught Python before C...