mruby/mruby — pull request #1396 by Archytaus (2013-07-21 09:11:56+00:00)
Title: Performance improvement of methods generated by Module#attr

Improved the performance of calling the methods generated by:
* Module#attr
* Module#attr_reader
* Module#attr_writer
* Module#attr_accessor

And performance calling:
* Module#instance_variable_get - when a string is used for the first argument
* Module#instance_variable_set - when a string is used for the first argument
* Module#instance_variable_defined? - when a string is used for the first argument

Previously calls to instance_variable_* would iterate over the symbol table to find the symbol name, and validate that it is a valid instance variable name. Now if a string is provided as the parameter, it won't iterate through the symbol table to find the name.

By modifying ao-render.rb (at 64 x 64) to use attr methods this is the improvement:

Before

23.4 seconds

After

14.1 seconds