berkerpeksag / astor

Python AST read/write
https://pypi.org/project/astor/
BSD 3-Clause "New" or "Revised" License
810 stars 102 forks source link

Enhance code generator performance #70

Closed pmaupin closed 7 years ago

pmaupin commented 7 years ago

Overall, when running rtrip on the 3.6 stdlib, this reduces the time spent in code generation by 40%, for an overall gain of 23%. There is lots of room for improvement in node_util (for the scrubbing, comparison, and dumping, not for the code generation), but I'm not willing to do that at the moment.

edited: Found even more gains in the strings, and created a fast comparison in node_util for rtrip. rtrip is much faster now.