Commit 8b0605cc authored by POTTIER Francois's avatar POTTIER Francois

Micro-optimization in [InfiniteArray.{set,update}].

Avoid call to [max], and write [a.extent] only if needed.
parent 579d3202
......@@ -39,13 +39,15 @@ let get a i =
let set a i x =
ensure a i;
Array.unsafe_set a.table (i) x;
a.extent <- max (i + 1) a.extent
if a.extent <= i then
a.extent <- i + 1
let update a i f =
ensure a i;
let x = a.table.(i) in
Array.unsafe_set a.table (i) (f x);
a.extent <- max (i + 1) a.extent
if a.extent <= i then
a.extent <- i + 1
let extent a =
a.extent
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment