Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Array.create instead of Array.init in hashtable resizing #8

Closed
madroach opened this issue Feb 19, 2017 · 1 comment
Closed

Use Array.create instead of Array.init in hashtable resizing #8

madroach opened this issue Feb 19, 2017 · 1 comment

Comments

@madroach
Copy link

madroach commented Feb 19, 2017

diff --git src/hashtbl.ml src/hashtbl.ml
index 1c18784..b0371c8 100644
--- src/hashtbl.ml
+++ src/hashtbl.ml
@@ -102,7 +102,7 @@ let maybe_resize_table t =
     let new_array_length = Int.min (len * 2) max_table_length in
     if new_array_length > len then begin
       let new_table =
-        Array.init new_array_length ~f:(fun _ -> Avltree.empty)
+        Array.create new_array_length Avltree.empty
       in
       let old_table = t.table in
       t.table <- new_table;
@ghost
Copy link

ghost commented Feb 20, 2017

Thanks, I imported the patch

@ghost ghost closed this as completed Feb 20, 2017
This issue was closed.
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

No branches or pull requests

1 participant