Browse Source

Merge pull request #1105 from svaarala/add-equals-perftest

Add number equality comparison self test
pull/1076/head
Sami Vaarala 8 years ago
committed by GitHub
parent
commit
393da96231
  1. 46
      tests/perf/test-equals-fastint.js
  2. 46
      tests/perf/test-equals-nonfastint.js

46
tests/perf/test-equals-fastint.js

@ -0,0 +1,46 @@
/*
* Fastint equality comparison.
*/
function test() {
var i, x, y;
x = 1; y = 2;
for (i = 0; i < 1e6; i++) {
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
}
}
try {
test();
} catch (e) {
print(e.stack || e);
throw e;
}

46
tests/perf/test-equals-nonfastint.js

@ -0,0 +1,46 @@
/*
* Non-fastint equality comparison.
*/
function test() {
var i, x, y;
x = 1.1; y = 2.2;
for (i = 0; i < 1e6; i++) {
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
void (x == y); void (x == y); void (x == y); void (x == y); void (x == y);
}
}
try {
test();
} catch (e) {
print(e.stack || e);
throw e;
}
Loading…
Cancel
Save