benchmark request I2R (I)*1.0 and function call.

Vexorian

Why no custom sig?
Reaction score
187
Err, I need a benchmark that compares I2R(integervalue) , integervalue * 1.0 and a single function call in what regards to the time they take. I cannot do proper benchmarks since grimoire has no Linux support.
 
Reaction score
333
Is that I2R and [i*1.0 and a function call]?

Using the StopWatch natives, I tested 1000 calls to I2R against a 1000s call to:
JASS:
function X takes integer i returns real
    return i*1.00
endfunction

And found:
Code:
[B]I2R:[/B]
 2.634, 4.774, 2.484, 2.468, 2.739, 2.540, 2.557
[B]X:[/B]
 4.090, 3.534, 3.794, 3.576, 3.575, 3.870, 3.664

Which seems to show that I2R is faster.
 

emjlr3

Change can be a good thing
Reaction score
395
he wanted I2R i believe

if i knew how stopwatch worked id do it
 

Vexorian

Why no custom sig?
Reaction score
187
No, actually.

I wanted three benchmarks.

One should test the time a function call that does nothing takes.

The other I2R(integervalue). And finally one should do (integervalue*1.0) and should not have any function call involved.

I guess something like this:

JASS:
//control:
set i=CONSTANT
loop
      exitwhen i==0
      set u=GetRandomInt(0,1000000000)
      set i=i-1
endloop



JASS:
//test 1
set i=CONSTANT
loop
      exitwhen i==0
      cal DoNothing()
      set u=GetRandomInt(0,1000000000)
      set i=i-1
endloop


JASS:
//test2
set i=CONSTANT
loop
      exitwhen i==0
      set r=I2R(GetRandomInt(0,1000000000))
      set i=i-1
endloop


JASS:
//test3
set i=CONSTANT
loop
      exitwhen i==0
      set r=GetRandomInt(0,1000000000)*1.0 //r is a real
      set i=i-1
endloop
 
Reaction score
333
Code:
[B]Control:[/B]
 2.728, 3.193, 3.025, 3.310, 3.189, 3.047, 3.340, 3.045, 3.117, 3.133
[B]DoNothing():[/B]
 3.348, 3.677, 3.487, 4.424, 3.638, 3.554, 5.100, 4.996, 3.561, 3.562
[B]I2R:[/B]
 4.486, 3.859, 4.093, 3.958, 6.023, 3.698, 3.859, 4.046, 3.970, 4.919
[B]i*1.0[/B]
 3.696, 3.638, 3.724, 3.621, 5.883, 5.287, 3.489, 3.588, 3.588, 3.453

JASS:
set t0 = StopWatchMark(sw)
loop
    exitwhen i == 0
    //call DoNothing() // function call
    //set x = GetRandomInt(0,1000000000) // control + function call
    //set r = I2R(GetRandomInt(0,1000000000)) // I2R
    //set r = GetRandomInt(0,1000000000)*1.0 // i*1.0
    set i = i-1
endloop
set t1 = StopWatchMark(sw)


i begins at 1000.
 

Vexorian

Why no custom sig?
Reaction score
187
one more, is it possible you did the DoNothing one on a map with 1000 functions that instead of calling DoNothing would call another empty function that's declared in the map?

Edit: Actually, make a function like this:

JASS:
function TR takes real level returns real
    return level
endfunction


And use it instead of I2R.

Right now it looks like inlinig functions with real arguments is a bad idea.
 
Reaction score
333
one more, is it possible you did the DoNothing one on a map with 1000 functions that instead of calling DoNothing would call another empty function that's declared in the map?

Edit: Actually, make a function like this:

JASS:

function TR takes real level returns real
    return level
endfunction


And use it instead of I2R.

Right now it looks like inlinig functions with real arguments is a bad idea.

As:
JASS:
set x = GetRandomInt(0,1000000000)
set r = TR(42.00)

Or:
JASS:
set r = TR(GetRandomReal(0,1000000000))

Or omit the call to GetRandomInt(0,1000000000) from the benchmark altogether?
 
Reaction score
333
Code:
[B]Control:[/B]
 3.776, 3.226, 4.881, 4.857, 2.886, 3.686, 2.948, 2.926, 3.251, 4.578, 3.166, 3.063
[B]Function Call:[/B]
 3.481, 3.579, 3.564, 3.465, 4.431, 4.666, 3.462, 3.613, 3.404, 5.441, 3.465, 5.629,
[B]TR:[/B]
 5.471, 5.969, 7.136, 7.030, 7.091, 5.075, 7.281, 5.786, 6.395, 5.077, 8.049, 6.170
[B]i*1.0:[/B]
 3.943, 5.053, 5.440, 5.853, 4.562, 4.627, 3.788, 4.852, 4.669, 4.483, 5.394, 4.147
 

Vexorian

Why no custom sig?
Reaction score
187
Well, actually TR replaced function call in the final tests table, anyways, this should be enough, looks like i*1.0 is faster than the function call+argument, this makes things amazingly easy for me, won't need to parse a lot of things to make inline work well.
 

emjlr3

Change can be a good thing
Reaction score
395
can you explain exactly how this benchmarking works, I have never been able to figure it out from the readme

or post your code or something
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top