From 0eb7359cc775c9d4c8dad68dd9dbf38c9680071e Mon Sep 17 00:00:00 2001 From: shyouhei Date: Tue, 5 Sep 2017 04:48:19 +0000 Subject: add rb_hash_new_with_size() Sometimes, size of a hash can be calcluated a priori. By providing such info to the constructor we can avoid unnecessary internal re- allocations. This can boost for instance creation of hash literals. [Bug #13861] Signed-off-by: Urabe, Shyouhei git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- internal.h | 1 + 1 file changed, 1 insertion(+) (limited to 'internal.h') diff --git a/internal.h b/internal.h index 6b13725caf..5f85909461 100644 --- a/internal.h +++ b/internal.h @@ -1242,6 +1242,7 @@ void ruby_sized_xfree(void *x, size_t size); /* hash.c */ struct st_table *rb_hash_tbl_raw(VALUE hash); +VALUE rb_hash_new_with_size(st_index_t size); VALUE rb_hash_has_key(VALUE hash, VALUE key); VALUE rb_hash_default_value(VALUE hash, VALUE key); VALUE rb_hash_set_default_proc(VALUE hash, VALUE proc); -- cgit v1.2.3