Skip to content

Commit

Permalink
[optimise] Avoid some double evaluation of RHS.
Browse files Browse the repository at this point in the history
This is very speculative, and needs reviewed, but is theoretically safe, as it just feels like code rearrangement.

In quickNodeSetCompare we evaluate RHS to decide if it is empty. In the case where it is not empty, we then look for an index to do comparison with; if there is no index, we defer to nodeSetCompare which throws away the RHS we just evaluated.

So, instead check for an index first, that is cheap. If there is an index, do what we did before and evaluate RHS, checking for empty.

If there is no index, defer straight to nodeSetCompare.

Result is consistently 18.4s rather than 18.8s for 20 repetitions on the M1 Max 64.
  • Loading branch information
alanpaxton authored and adamretter committed Dec 1, 2024
1 parent 4e235d3 commit 5e8d3a3
Showing 1 changed file with 172 additions and 149 deletions.
Loading

0 comments on commit 5e8d3a3

Please sign in to comment.