You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that there may be another optimisation that can be added to IntegerEqualsNode, a variant of (#6429). Specifically, comparing the Xor of two values against the Not of one of them is equivalent to comparing the other value to -1.
This optimisation has also been formally verified in an interactive theorem prover (Isabelle/HOL).
Sample Program
To determine whether this optimisation provided a speed-up, I used the same sample program as in (#8679) but changed the unoptimised and optimised lines to:
oubidar-Abderrahim
changed the title
Potential new optimisation for IntegerEqualsNode
[GR-53019] Potential new optimisation for IntegerEqualsNode
Apr 2, 2024
Overview
Hi,
I noticed that there may be another optimisation that can be added to IntegerEqualsNode, a variant of (#6429). Specifically, comparing the Xor of two values against the Not of one of them is equivalent to comparing the other value to
-1
.This optimisation has also been formally verified in an interactive theorem prover (Isabelle/HOL).
Sample Program
To determine whether this optimisation provided a speed-up, I used the same sample program as in (#8679) but changed the
unoptimised
andoptimised
lines to:The optimised version is around 35% faster than the unoptimised version, yielding runtimes of approximately 1.29s and 1.98s, respectively.
Unit Test
I've also written a JUnit test to check whether this optimisation is applied:
Running this test produces the following output:
The text was updated successfully, but these errors were encountered: