Without deeply understanding the differences, I can at least say that attr_accessor
(and attr_reader
and attr_writer
) are implemented in C, as you can see by toggling the source on that page. Your methods will be implemented in Ruby, and Ruby methods have more call overhead than native C functions.
Here's an article explaining why Ruby method dispatch tends to be slow.