aboutsummaryrefslogtreecommitdiffhomepage
path: root/kernel/csymtable.ml
diff options
context:
space:
mode:
authorGravatar Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr>2018-03-07 12:03:47 -0300
committerGravatar Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr>2018-03-26 08:57:39 +0200
commit93c8e14d0c9bc233b2dcf213485b62a533b34580 (patch)
treedcf1e391ebf9e87947294eb3a822829c7d26381a /kernel/csymtable.ml
parentfd5dc5b37e765bdb864e874c451d42d03d737792 (diff)
More efficient reallocation of VM global tables.
The previous code was mimicking what the C implementation was doing, which was a quadratic algorithm. We simply use the good old exponential reallocation strategy that is amortized O(1).
Diffstat (limited to 'kernel/csymtable.ml')
-rw-r--r--kernel/csymtable.ml2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/csymtable.ml b/kernel/csymtable.ml
index 23b419473..4f3cbf289 100644
--- a/kernel/csymtable.ml
+++ b/kernel/csymtable.ml
@@ -47,7 +47,7 @@ let global_data = {
let get_global_data () = Vmvalues.vm_global global_data.glob_val
let realloc_global_data n =
- let n = min (n + 0x100) Sys.max_array_length in
+ let n = min (2 * n + 0x100) Sys.max_array_length in
let ans = Array.make n crazy_val in
let src = global_data.glob_val in
let () = Array.blit src 0 ans 0 (Array.length src) in