Project

General

Profile

« Previous | Next » 

Revision abff5f62

Added by peterzhu2118 (Peter Zhu) almost 3 years ago

Move classpath to rb_classext_t

This commit moves the classpath (and tmp_classpath) from instance
variables to the rb_classext_t. This improves performance as we no
longer need to set an instance variable when assigning a classpath to
a class.

I benchmarked with the following script:

name = :MyClass puts(Benchmark.measure do 10_000_000.times do |i| Object.const_set(name, Class.new) Object.send(:remove_const, name) end end) 

Before this patch:

 5.440119 0.025264 5.465383 ( 5.467105) 

After this patch:

 4.889646 0.028325 4.917971 ( 4.942678)