int versus float (v6)

Revision 6 of this benchmark created by Kel on


Setup

var intA = 65536 | 0;
    var intB = 2 | 0;
    var floatA = 65000.251;
    var floatB = 1.987;
    
    var c = 0 | 0;
    var d = 0.0;
    var i = 0 | 0;

Teardown


    c = intA;
    d = floatA;
  

Test runner

Ready to run.

Testing in
TestOps/sec
int add
for(i=0; i<15; ++i) {
  c += intB;
}
ready
float add
for(i=0; i<15; ++i) {
  d += floatB;
}
ready
int multiply
for(i=0; i<15; ++i) {
  c *= intB;
}
ready
float multiply
for(i=0; i<15; ++i) {
   d *= floatB;
}
ready
int divide
for(i=0; i<15; ++i) {
  c /= intB;
}
ready
float divide
for(i=0; i<15; ++i) {
  d /= floatB;
}
ready
imul
for(i=0; i<15; ++i) {
  c = Math.imul(c, intB);
}
ready

Revisions

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