Optimize ripper bounds, and one other small perf tweak#4083
Optimize ripper bounds, and one other small perf tweak#4083
Conversation
|
I don't think I want that generally in parse result. Can you put that into the ripper translator? (Just not sure if we truly want to support that for everyone going forward.) I see you must have determined |
3e8c264 to
ee99eee
Compare
Yeah, I can move it. I had it nodoc but that's fine too.
It's probably not. But it also only happens for what ripper considers void statements. The change is only to make 3e8c264 work, and overall it comes out positive. |
ee99eee to
c22a6fd
Compare
Basically a port of ruby/ruby@c45f781 into ruby It's quite effective at ~97% hit rate for me. Speeds it up from ~6.77x slower to only 4.07x slower. For the lexer `on_sp` it also gives a bit of an improvement: 1.04x slower to 1.10x faster I guess the class may be universally useful but for now I just made it nodoc.
It's a small, somewhat hacky performance boost. Locations are lazy, by freezing the result they don't have to be pack/unpacked redundantly. This gives about a 4% speed boost. Other changes are to not modify the frozen AST
c22a6fd to
9e93bd6
Compare
Basically a port of ruby/ruby@c45f781 into ruby
It's quite effective at ~97% hit rate for me. Speeds it up from ~6.77x slower to only 4.07x slower.
For the lexer
on_spit also gives a bit of an improvement: 1.04x slower to 1.10x fasterI guess the class may be universally useful but for now I just made it nodoc. I also didn't look much into the window, it seemed good enough.
Other commit is a small hack to skip redudant pack/unpacking of locations. Prism by default packs locations into a 64bit integer and later extracts start offset / length to create the location. But we know we access nearly all of the locations anyways, so we can request a frozen result to compute them eagerly. It gives about a 4% speed boost.
Benchmark from 2ea8139