Project

General

Profile

« Previous | Next » 

Revision cef8325e

Added by Eric Wong almost 10 years ago

struct.c: speedup for big structs

use simple custom open-addressing hash for big structs.

Original-patch-by: Sokolov Yura aka funny_falcon
in https://bugs.ruby-lang.org/issues/10585

  • struct.c (AREF_HASH_THRESHOLD): new macro
    (id_back_members): new ID
    (struct_member_pos_ideal): new function
    (struct_member_pos_probe): ditto
    (struct_set_members): ditto
    (struct_member_pos): ditto
    (rb_struct_getmember): use struct_member_pos for O(1) access
    (rb_struct_aref_sym): ditto
    (rb_struct_aset_sym): ditto
    (setup_struct): call struct_set_members
    (struct_define_without_accessor): ditto
    (Init_Struct): initialize members_back
    [ruby-core:66851] [ruby-core:69705] [ruby-core:69821]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e