• eska 34 minutes 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.

• westurner an hour 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

• adhami 40 minutes 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.

• westurner an hour ago

AST: Abstract Syntax Tree

FST: Full Syntax Tree

CST: Concrete Syntax Tree

Comment preservation is a feature

• 123rust123 an hour ago

let me guess, the improved version is written in Rust?

• adhami an hour 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