TEST: If vs Minus, speed test.

by Sebastian Norr

Version 1 (March 7, 2021)

Download (38 downloads)

Is it faster to check:
A = B, or
A != B, or
(A -B) = 0

(My) RESULT:
#1: A != B (Usually wins).
#2: A = B (Sometimes wins).
#3: (A-B)=0 (Almost never wins).

NOTE!
The result will vary depending on the phone and what is doing at the time.

The testAmount variable (1M tries) is chosen to be resulting in about 2 seconds per test (on my phone), to average out processor work differences.
And the tests re-runs 5 times, for the same reason & to spot outlier results.

Feel free to expand on the tests.

4.5 average rating from 2 reviews

5 stars
1
4 stars
1
3 stars
0
2 stars
0
1 star
0
Reports
0

Rate and review within the app in the Community section.