summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-30 00:20:15 (GMT)
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-30 00:20:15 (GMT)
commitf6cd582505429fa95a4cf697507d8f39959f48d1 (patch)
treef4d574df20393cb170fa9cd37c0b4160d3246f73 /benchmark
parentc7ddf9d5165ff3fd739f1b3f54837899c185a0be (diff)
variable.c: avoid compatibility table with generic ivars
This recovers and improves performance of Marshal.dump/load on Time objects compared to when we implemented generic ivars entirely using st_table. This also recovers some performance on other generic ivar objects, but does not bring bring Marshal.dump/load performance up to previous speeds. benchmark results: minimum results in each 10 measurements. Execution time (sec) name trunk geniv after marshal_dump_flo 0.343 0.334 0.335 marshal_dump_load_geniv 0.487 0.527 0.495 marshal_dump_load_time 1.262 1.401 1.257 Speedup ratio: compare with the result of `trunk' (greater is better) name geniv after marshal_dump_flo 1.026 1.023 marshal_dump_load_geniv 0.925 0.985 marshal_dump_load_time 0.901 1.004 * include/ruby/intern.h (rb_generic_ivar_table): deprecate * internal.h (rb_attr_delete): declare * marshal.c (has_ivars): use rb_ivar_foreach (w_ivar): ditto (w_object): update for new interface * time.c (time_mload): use rb_attr_delete * variable.c (generic_ivar_delete): implement (rb_ivar_delete): ditto (rb_attr_delete): ditto [ruby-core:69323] [Feature #11170] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/bm_marshal_dump_load_geniv.rb10
-rw-r--r--benchmark/bm_marshal_dump_load_time.rb1
2 files changed, 11 insertions, 0 deletions
diff --git a/benchmark/bm_marshal_dump_load_geniv.rb b/benchmark/bm_marshal_dump_load_geniv.rb
new file mode 100644
index 0000000..8252ad9
--- /dev/null
+++ b/benchmark/bm_marshal_dump_load_geniv.rb
@@ -0,0 +1,10 @@
+a = ''
+a.instance_eval do
+ @a = :a
+ @b = :b
+ @c = :c
+end
+100000.times do
+ a = Marshal.load(Marshal.dump(a))
+end
+#p(a.instance_eval { @a == :a && @b == :b && @c == :c })
diff --git a/benchmark/bm_marshal_dump_load_time.rb b/benchmark/bm_marshal_dump_load_time.rb
new file mode 100644
index 0000000..e29743b
--- /dev/null
+++ b/benchmark/bm_marshal_dump_load_time.rb
@@ -0,0 +1 @@
+100000.times { Marshal.load(Marshal.dump(Time.now)) }