Skip to content

Commit

Permalink
Merge pull request #16 from lindig/perf
Browse files Browse the repository at this point in the history
Compute length only once
  • Loading branch information
patricoferris authored Aug 11, 2023
2 parents c85fe48 + 1438a4e commit 16a8688
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/rtree.ml
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,12 @@ module Make (E : Envelope) (V : Value with type envelope = E.t) = struct
|> Float.ceil |> int_of_float

let rec omt ~m entries =
if List.length entries <= m then
let length = List.length entries in
if length <= m then
let leaves = List.map (fun v -> (V.envelope v, v)) entries in
Leaf leaves
else
let slices = number_along_axis ~m (List.length entries) in
let slices = number_along_axis ~m length in
let q =
let q' = Queue.create () in
Queue.add (entries, E.dimensions - 1) q';
Expand Down

0 comments on commit 16a8688

Please sign in to comment.