Project

General

Profile

Actions

Feature #13174

open

Smaller id_table on 64bit platform

Added by funny_falcon (Yura Sokolov) almost 8 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:79366]

Description

Reduce size of id_table by 25% on 64bit platform (19% on smallest table):

  • embed collision bit into key
  • use array of keys + array of values instead of array of struct item_t.
    Both arrays allocated at once, and pointer to values is calculated.

Additional changes:

  • stricter check in next_id_base.
    One bit is needed for collision check on 64bit platform.
    Range is more limited on 32bit platform with ID_SCOPE_SHIFT and RUBY_SPECIAL_SHIFT.
  • stricter check for result of next_id_base.
    Rais exception in rb_sym2id, assert in rb_make_internal_id.
  • allow to shrink id_table.
    Shrink was disabled for mix_table cause it leads to error in id_table type
    detection. Since mix_table were removed, it is safe to shrink it again.
  • improve large table performance by mixin higher bits into step value.

Performance of small tables almost the same.
Mixing higher bits takes 1-2% for small tables on hit, but improves large table
performance.

Report: https://gist.github.com/funny-falcon/7a1af6b3891ae636b12237f25eb20690

https://github.com/funny-falcon/ruby/tree/smaller_id_table
https://github.com/ruby/ruby/compare/trunk...funny-falcon:smaller_id_table.patch


Files

improve_id_table.patch (10.2 KB) improve_id_table.patch funny_falcon (Yura Sokolov), 01/31/2017 02:05 PM

No data to display

Actions

Also available in: Atom PDF

Like0