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/
31•palashawas•1h 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•55m 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•54m ago
AST: Abstract Syntax Tree

FST: Full Syntax Tree

CST: Concrete Syntax Tree

Comment preservation is a feature

adhami•47m 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•41m 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•7m 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/

Show HN: Pen and paper resource development game

https://www.jameshylands.co.uk/2026/06/sortis-paper-empire-game.html
1•jhylands•43s ago•0 comments

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

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

Plakar: Open-source backup tool, 95% faster restores in v1.1.3

https://www.plakar.io/posts/2026-06-16/plakar-v1.1.3-is-here/
1•vcoisne•2m ago•0 comments

OAuth proves who you are. Wallet auth proves what you hold

https://insumermodel.com/blog/one-thesis-five-companies.html
1•dcborthwick•3m ago•0 comments

Stop Destroying Videogames Submission and Examination

https://citizens-initiative.europa.eu/stop-destroying-videogames_en
2•ortusdux•4m ago•0 comments

Ask HN: How do you stay at the bleeding edge of AI tooling?

1•otekengineering•4m ago•1 comments

FastAPI and Nuxt and Web3 Boilerplate

https://www.pynuxt.com/en/
1•k0ngz1•7m ago•1 comments

Claude Workout Gate

https://github.com/BotchetDig/workout-gate
1•kyleblarson•7m ago•0 comments

U.S. battery industry cuts losses, shifts to new ventures amid EV bust

https://www.dallasfed.org/research/economics/2026/0303
1•speckx•8m ago•1 comments

Pinning down a hardware bug in Intel 13th/14th gen CPUs

https://fgiesen.wordpress.com/2025/05/21/oodle-2-9-14-and-intel-13th-14th-gen-cpus/
1•fanf2•8m ago•0 comments

GLM-5.2: Built for Long-Horizon Tasks

https://z.ai/blog/glm-5.2
1•meetpateltech•9m ago•1 comments

Show HN: Ito – Code reviews that run code

https://www.ito.ai
3•evanmarshall•9m ago•0 comments

Oxford Digital News Report 2026

https://reutersinstitute.politics.ox.ac.uk/digital-news-report/2026
2•thm•10m ago•0 comments

How to Demolish a Bridge

https://practical.engineering/blog/2026/6/16/how-to-demolish-a-bridge
1•crescit_eundo•11m ago•0 comments

Publishers Sue WeLib for Copyright Infringement

https://www.publishersweekly.com/pw/by-topic/digital/copyright/article/100652-publishers-sue-pira...
2•ilamont•12m ago•0 comments

The Google / Xreal Aura XR glasses are now available to preorder

https://www.theverge.com/gadgets/950597/xreal-google-aura-xr-glasses-deposit-scheme
1•MehrdadKhnzd•12m ago•0 comments

Ipcrawl: A living atlas of open webcams discovered on the public internet

https://ipcrawl.com
1•arm32•12m ago•0 comments

Show HN: I made Oregon Trail for founders (paste your company URL)

https://foundertrail.vercel.app/
1•jgvandehey•12m ago•1 comments

Piu

1•mostafaabdrabu•13m ago•0 comments

Microsoft Clarity Is Down?

https://clarity.microsoft.com/
1•rkj93•13m ago•0 comments

Jami – Feature Drop: Shared Services

https://jami.net/shared-services/
1•kevincox•13m ago•0 comments

FBI disrupted alleged terror plot targeting White House UFC event [video][5 min]

https://www.youtube.com/watch?v=JCLN9psHjxY
2•Bender•14m ago•0 comments

Simdjson: Parsing gigabytes of JSON per second

https://github.com/simdjson/simdjson
1•saikatsg•16m ago•0 comments

A satellite just learned to find things on its own – here's what that means

https://techcrunch.com/2026/06/15/a-satellite-just-learned-to-find-things-on-its-own-heres-what-t...
1•speckx•16m ago•0 comments

Microsoft turns to Amazon for help with GitHub's AI-driven capacity issues

https://www.businessinsider.com/microsoft-github-amazon-ai-cloud-capacity-2026-6
1•otterley•17m ago•0 comments

Third SAIR competition: inverse Galois challenge

https://terrytao.wordpress.com/2026/06/16/third-sair-competition-inverse-galois-challenge/
1•jjgreen•17m ago•0 comments

At first, it does sound crazy: meet the scientists trying to refreeze the Arctic

https://www.theguardian.com/environment/2026/jun/16/arctic-sea-ice-rethickening-climate-geoengine...
1•robaato•20m ago•0 comments

Claude: Elevated errors across many models

https://status.claude.com/incidents/xmhsglsz3h3w
50•forks•20m ago•19 comments

Logical Ways to Track AI Agent Lineage and State in Code Development

https://davenporter.substack.com/p/how-to-track-ai-agent-lineage-and
1•davenportjw•20m ago•0 comments

Making things: interview series on creativity

https://digitalseams.com/blog/making-things-interview-series
1•bobbiechen•24m ago•0 comments