

Why Ruby's attr_accessor is faster than getters and setters - sethvargo
https://www.omniref.com/ruby/2.2.0/files/method.h?#annotation=4081781&line=47

======
davidcelis
I still don't know "why" even after reading this. The highlighted block of C
doesn't tell me anything and neither does the comment on it. As far as I can
tell, this is just a benchmark with no explanation.

~~~
Someone
_" Why attr_reader and attr_writer are faster than def

VM_METHOD_TYPE_ATTRSET and VM_METHOD_TYPE_IVAR are the reason attr_accessor is
significantly faster than a normal method created with def. These are
implemented as pure C functions without creating a new Ruby stack frame, or
executing compiled Instruction Sequences inside the VM."_

------
wrl
Really enjoying this "Please sign in to save view settings" modal box that
pops up when I try to move the divider between the post and the source code.
Who thought that was a good idea?

~~~
timr
Oops, that's a bug -- it's supposed to prompt you once, just to give you the
option to save the setting. I'm pushing a fix now.

Sorry about that!

~~~
wrl
Hey, no problem, thanks for taking care of that. Sorry about my acerbic tone!

