Post

TIL: In Ruby, there is a significant performance difference between calling `obj.my_method` vs calling `obj.send(:my_method)`. To be clear, "Significant" in this instance is more the realm of microbenchmarks, or very hot code path optimizations (hundreds of thousands/millions of calls). /🧵

Awesome, thanks for the correction! And wow, `public_send`, ouch. Those numbers are rough. I noticed that `send` seems to have a specialized version and `public_send` doesn't, must be related to that somehow?

Oh yea I noticed your note - # YJIT has an optimization for send but not public_send Would be nice to optimize public_send - that's usually my recommendation if I see people using send.

0 reposts2 likes

No replies yet.