Issue #11170 has been updated by Koichi Sasada.


+1.

T_CLASS/T_MODULE can use same technique, but it seems not so many use-cases.

----------------------------------------
Feature #11170: [PATCH] use ivar indices for generic ivars
https://bugs.ruby-lang.org/issues/11170#change-52592

* Author: Eric Wong
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
* [PATCH 1/2] variable.c: extract common functions for generic ivar
  http://80x24.org/spew/m/4e9df8a150a121c894fe142bde5efc15d43e5e94.txt
* [PATCH 2/2] variable.c: use indices for generic ivars
  http://80x24.org/spew/m/aabb09c886a23ea496722b13f2b39da8606b8180.txt

This reduces memory overhead of ivars for common types such as
T_DATA the same way T_OBJECT does it.

For 9992 accepted clients on an OpenSSL server, this reduces RSS memory
from 77160K to 69248K on x86-64 with the attached ossl.rb script.
Connecting client process was reduced from 246312K to 230724K RSS.

OpenSSL 1.0.1e-2+deb7u16 on Debian 7


---Files--------------------------------
ivar-reduce-combined.patch (17.2 KB)
ossl_11170.rb (1.74 KB)


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