frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Making ast.walk 220x Faster

https://reflex.dev/blog/why-ast-walk-when-you-can-ast-sprint/
37•palashawas•2h ago

Comments

123rust123•1h ago
let me guess, the improved version is written in Rust?
adhami•1h ago
only because I'm too lazy to learn how to write C with Python, if anything Rust wasn't helpful with all of those unsafes
westurner•1h ago
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

westurner•1h ago
AST: Abstract Syntax Tree

FST: Full Syntax Tree

CST: Concrete Syntax Tree

Comment preservation is a feature

adhami•1h ago
it's possible! although many of the constraints in this blog were because we wanted to work with ast module in Python. If we were allowed to create our own types, we can do so much better. I think ruff has an even faster walk by those standards.

It seems bandit is using some decent optimizations already, looking at the `@test.checks("Call")` seems like they already captured some easy wins.

The largest win honestly would be using the same ast.walk for multiple rules, which we also did, but not mentioned in the blog.

eska•1h ago
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.
jerf•53m ago
I often use the rough approximation that Python is 40-50x slower than C. This is what you'll see in the benchmarks.

The truly rough thing about Python though is that that is the speed when the code is being written to a benchmark. It is really, really easy to write Python that is multiples slower than that when not writing to a benchmark and just trying to get work done without hyperoptimizing. I did some testing of Python [1] to back some other commentary I was making that compared the time it took to set an attribute repeatedly on a particular instance of an empty class to the time it took to setting it on a subclass of a subclass of a class that had a property setter that was wrapped by a decorator. The latter was about 4.6 time slower than the direct attribute setting, which was itself already ~100x slower than an attribute setting in a static language.

And it's not like a three-deep nested class with a property wrapped by a decorator is all that absurd in Python or anything. That's a completely normal case, not some absurd example I made up to skew the test.

In practice the 40-50x number is more lower bound than what you can count on. If you are actually using Python's features I think you can easily score another order of magnitude slower without anything jumping out at you as being an obviously bad idea.

[1]: https://jerf.org/iri/post/2024/not_about_python_addendum/

colechristensen•35m ago
A while back I had claude implement something, I don't quite remember what it was, but it chose Python. It was going to take hours. I told it to rewrite it in Rust and it was > 300000x faster. This is without any optimization or prompting particularly about performance, a short one shot lift.

echo "Python sucks, use something else when you can" >> ~/CLAUDE.md

Python was cool in 2005 in academia IT, all the rage in startup 2012. These days...

Running local models is good now

https://vickiboykis.com/2026/06/15/running-local-models-is-good-now/
570•jfb•3h ago•274 comments

Claude: Elevated errors across many models

https://status.claude.com/incidents/xmhsglsz3h3w
106•forks•1h ago•74 comments

SpaceX to buy Cursor for $60B

https://www.reuters.com/legal/transactional/spacex-buy-anysphere-60-billion-2026-06-16/
522•itsmarcelg•7h ago•904 comments

TIL: You can make HTTP requests without curl using Bash /dev/TCP

https://mareksuppa.com/til/bash-dev-tcp-http-without-curl/
70•mrshu•1h ago•41 comments

Mechanical Watch (2022)

https://ciechanow.ski/mechanical-watch/
522•razin•7h ago•96 comments

Gamers beware: malicious wallpapers on Steam found stealing accounts

https://securelist.com/dozens-of-malicious-wallpapers-found-on-steam-workshop/120186/
35•speckx•1h ago•20 comments

But yak shaving is fun

https://parksb.github.io/en/article/32.html
98•parksb•4h ago•25 comments

Making ast.walk 220x Faster

https://reflex.dev/blog/why-ast-walk-when-you-can-ast-sprint/
42•palashawas•2h ago•9 comments

After AI Takes Everything

https://ursb.me/en/posts/after-ai-takes-everything/
55•speckx•3h ago•44 comments

GPT‑NL: a sovereign language model for the Netherlands

https://www.tno.nl/en/digital/artificial-intelligence/gpt-nl/
14•root-parent•42m ago•2 comments

SubQ 1.1 Small

https://subq.ai/subq-1-1-small-technical-report
72•EDM115•3h ago•32 comments

Apple's weird anti-nausea dots cured my car sickness

https://www.theverge.com/tech/942854/apple-vehicle-motion-cues-review-really-work
203•neilfrndes•2h ago•68 comments

Correlated randomness in Slay the Spire 2

https://tck.mn/blog/correlated-randomness-sts2/
224•rdmuser•8h ago•71 comments

10Gb/s Ethernet: switching to a Broadcom SFP+ module

https://www.gilesthomas.com/2026/06/10g-ethernet-switching-to-broadcom-sfp-plus
13•gpjt•47m ago•6 comments

Calvin and Hobbes and the price of integrity

https://therepublicofletters.substack.com/p/calvin-and-hobbes-and-the-price-of
13•pseudolus•2h ago•2 comments

I admire Fabrice Bellard. He is almost certainly a better overall programmer

https://twitter.com/ID_AA_Carmack/status/2064095424420487226
763•apitman•13h ago•365 comments

Formal Methods and the Future of Programming

https://blog.janestreet.com/formal-methods-at-jane-street-index/
21•nextos•4d ago•1 comments

Why is Meta destroying its engineering organization?

https://newsletter.pragmaticengineer.com/p/why-is-meta-destroying-its-engineering
112•throwarayes•1h ago•68 comments

The time the x86 emulator team found code so bad they fixed it during emulation

https://devblogs.microsoft.com/oldnewthing/20260615-00/?p=112419
451•paulmooreparks•13h ago•144 comments

Cooling at the Speed of Light

https://cacm.acm.org/news/cooling-at-the-speed-of-light/
7•sohkamyung•3d ago•0 comments

The octopus architecture for AI agents

https://blog.goodman.dev/blog/octopus-agent-architecture/
11•joshbetz•1h ago•2 comments

Qwen-Robot Suite: A Foundation Model Suite for Physical World Intelligence

https://qwen.ai/blog?id=qwen-robotsuite
53•ilreb•5h ago•4 comments

An interview with an Apple emoji designer

https://shadycharacters.co.uk/2026/06/ollie-wagner/
72•nate•3d ago•35 comments

'Ghost jobs' could soon be illegal in New York

https://www.fastcompany.com/91558427/ghost-jobs-could-soon-be-illegal-in-new-york
47•toomuchtodo•1h ago•17 comments

Specs Augmented Reality Glasses

https://newsroom.snap.com/introducing-specs-augmented-reality-glasses
22•haberdasher•1h ago•9 comments

Stop Using JWTs

https://gist.github.com/samsch/0d1f3d3b4745d778f78b230cf6061452
14•dzonga•1h ago•8 comments

Getting Creative with Perlin Noise Fields

https://sighack.com/post/getting-creative-with-perlin-noise-fields
131•0x000xca0xfe•2d ago•21 comments

Unicorn – The Ultimate CPU Emulator

https://www.unicorn-engine.org/
68•tosh•7h ago•19 comments

Show HN: Garden of Flowers – an archive of pictorial typography before ASCII art

https://garden-of-flowers.heikkilotvonen.com/
130•california-og•14h ago•20 comments

Feds freaked over Fable 5 after 'fix this code', not jailbreak, say researchers

https://www.theregister.com/security/2026/06/15/feds-freaked-over-fable-5-after-simple-fix-this-c...
488•_tk_•9h ago•292 comments