Project

General

Profile

Feature #8158

lightweight structure for loaded features index

Added by Yura Sokolov over 3 years ago. Updated about 2 months ago.

Status:
Assigned
Priority:
Normal
[ruby-core:53688]

Description

Use lightweight structure for loaded_features index:

  • use hand made simple hash structure, which uses only one memory chunk,
  • do not store feature name string, only hash of it, since loaded_feature_path will recheck feature name on hash collision
  • use single linked lists instead of arrays for storing features indices.
  • store this lists inside one array, using array's indices as a reference.

While startup speedup improvement is relatively small compared current implementation,
this one does not need any Ruby Objects at all, so that there is no presure on GC.

https://github.com/ruby/ruby/pull/264.patch
https://github.com/ruby/ruby/pull/264.diff
https://github.com/ruby/ruby/pull/264

264.patch View (14.9 KB) Zachary Scott, 04/05/2013 11:43 AM

0001-load.c-reduce-memory-usage-of-loaded_features_index.patch View (5.87 KB) Yura Sokolov, 10/07/2016 01:19 PM

History

#2 [ruby-core:54010] Updated by Zachary Scott over 3 years ago

#3 [ruby-core:57523] Updated by Nobuyoshi Nakada about 3 years ago

  • Assignee set to Nobuyoshi Nakada
  • Status changed from Open to Assigned

#4 [ruby-core:60285] Updated by Hiroshi SHIBATA almost 3 years ago

  • Target version changed from 2.1.0 to current: 2.2.0

#6 [ruby-core:77516] Updated by Yura Sokolov about 2 months ago

I've changed implementation a bit:
Because https://bugs.ruby-lang.org/issues/12142 likely to be accepted,
I've used st_table with numtable instead of separate datastructure.

So patch now is shorter.
https://bugs.ruby-lang.org/attachments/download/6182/0001-load.c-reduce-memory-usage-of-loaded_features_index.patch

Also available in: Atom PDF