[ruby-core:65308] [ruby-trunk - Feature #10302] [PATCH] marshal.c: lazy compat_tbl allocation

From: nobu@...
Date: 2014-09-28 04:46:30 UTC
List: ruby-core #65308
Issue #10302 has been updated by Nobuyoshi Nakada.

Description updated

Seems fine.

----------------------------------------
Feature #10302: [PATCH] marshal.c: lazy compat_tbl allocation
https://bugs.ruby-lang.org/issues/10302#change-49127

* Author: Eric Wong
* Status: Open
* Priority: Normal
* Assignee: Eric Wong
* Category: core
* Target version: current: 2.2.0
----------------------------------------
Will commit in a few days.

In some common cases, `compat_tbl` is unused in `dump_arg`/`load_arg`,
so avoid malloc/free costs for the unused table.

~~~
ruby -e 'h = {a: :b}; 600000.times { Marshal.load(Marshal.dump(h)) }'

before:
	real    0m2.458s
	user    0m2.450s
	sys     0m0.006s

after:
	real    0m2.122s
	user    0m2.110s
	sys     0m0.011s
~~~

---Files--------------------------------
0001-marshal.c-lazy-compat_tbl-allocation.patch (4.26 KB)


-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next