summaryrefslogtreecommitdiffhomepage
path: root/src/hash.c
diff options
context:
space:
mode:
authorChristopher Aue <[email protected]>2017-08-04 22:08:29 +0200
committerChristopher Aue <[email protected]>2017-08-04 22:08:29 +0200
commit0e5c3c4ebdd0b5f79b90eaeb099c9689c22895b5 (patch)
treeb69ffa08b8dba6cd2d7cbe2b88db46487f5ded7a /src/hash.c
parent1b9c4855a3178238ab1c71addbfa364468abb1fe (diff)
downloadmruby-0e5c3c4ebdd0b5f79b90eaeb099c9689c22895b5.tar.gz
mruby-0e5c3c4ebdd0b5f79b90eaeb099c9689c22895b5.zip
Improved speed of creating new hash tables
Diffstat (limited to 'src/hash.c')
-rw-r--r--src/hash.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/hash.c b/src/hash.c
index 27d25b384..58b6b2f53 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -145,10 +145,7 @@ mrb_hash_new_capa(mrb_state *mrb, mrb_int capa)
struct RHash *h;
h = (struct RHash*)mrb_obj_alloc(mrb, MRB_TT_HASH, mrb->hash_class);
- h->ht = kh_init(ht, mrb);
- if (capa > 0) {
- kh_resize(ht, mrb, h->ht, capa);
- }
+ h->ht = kh_init_size(ht, mrb, capa);
h->iv = 0;
return mrb_obj_value(h);
}