You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have to encode 64 bit integers all the time (basically every field header requires it), so I tried unrolling the uint64 encoding logic to see what kind of performance gains we can get.
I tried 3 different ways of unrolling the loop:
Just a naive way translating the while loop to if statements
Same as 1, but eliminating intermediate local variable writes
Rather than appending to the buffer for each byte, use the Array#pack optimization
Unrolling the loop seems to help the interpreter, but doesn't seem to do much for YJIT. I'm a little bit surprised by how slow the Array#pack solution is on YJIT, I expected it to fare better since I merged ruby/ruby#8734
The text was updated successfully, but these errors were encountered:
We have to encode 64 bit integers all the time (basically every field header requires it), so I tried unrolling the uint64 encoding logic to see what kind of performance gains we can get.
I tried 3 different ways of unrolling the loop:
Array#pack
optimizationThe code is below:
Click me for benchmark
Results are below.
Interpreter:
YJIT:
Unrolling the loop seems to help the interpreter, but doesn't seem to do much for YJIT. I'm a little bit surprised by how slow the
Array#pack
solution is on YJIT, I expected it to fare better since I merged ruby/ruby#8734The text was updated successfully, but these errors were encountered: