baron
baron copied to clipboard
Performance question
I've recently discovered the newly release library parso that seems to overlap a bit with what baron does (but provides python 3 support!). I prefer the pure dicts/list/etc data structure of baron over the class heavy style of parso, but otherwise they seem similar. A big difference though is speed:
In [1]: len(code)
Out[13]: 501631
In [2]: %timeit code == baron.dumps(baron.parse(code))
1 loop, best of 3: 16.5 s per loop
In [3]: %timeit code == parso.parse(code).get_code()
1 loop, best of 3: 4.46 s per loop
This is a pretty big big file as you can see, and the difference in speed is quite dramatic. Maybe something to look at...