Skip to content

Conversation

jhawthorn
Copy link
Owner

WIP

It's faster to buffer items in a (C) array before creating a hash from them. Partly because this avoids the cost in Ruby of building a ar_table before it is converted to an st_table once the hash goes beyond 8 elements.

I don't believe this has been tested sufficiently yet.

hash_buffer_idx--;
}

VALUE hash = rb_hash_new_capa(hash_buffer_idx / 2);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added rb_hash_new_capa in 3.2, we'd likely need a fallback for older rubies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants