classic test vs branchless

Benchmark created on


Setup

let min = Number.MAX_VALUE;
let max = -Number.MAX_VALUE;
let dot = Math.random();

Test runner

Ready to run.

Testing in
TestOps/sec
classic
if (dot < min) { min = dot; }
if (dot > max) { max = dot; }
ready
branchless
min = dot * (dot < min) + min * (dot >= min);
max = dot * (dot > max) + max * (dot <= max);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.