2 ms·
"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
by Someone 12y ago
"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."