RE: Type-checking performance

new topic     » goto parent     » topic index » view thread      » older message » newer message

Patrick Barnes wrote:
> 
> 
> Heh... oops.
> > }}}
<eucode>
> ...
> > time_elapsed = time()
> > for a = 1 to ITER do var1 += 1 end for
> > printf(1, "Type1: %f\n", { time() - time_elapsed } )
> > 
> > time_elapsed = time()
> > for a = 1 to ITER do var2 += 1 end for
> > printf(1, "Type2: %f\n", { time() - time_elapsed } )
> > 
> > time_elapsed = time()
> > for a = 1 to ITER do var1 += 1 end for
> > printf(1, "Type3: %f\n", { time() - time_elapsed } )
> This should actually be 'var3 +=1'
> > 
> > time_elapsed = time()
> > for a = 1 to ITER do var4 += 1 end for
> > printf(1, "Type4: %f\n", { time() - time_elapsed } )
> > </eucode>
{{{

> > 
> > Outputs this:
> > Type1: 0.820000
> > Type2: 0.950000
> > Type3: 0.830000
> > Type4: 0.060000
> Now outputs this:
> Type1: 0.890000
> Type2: 0.910000
> Type3: 0.860000
> Type4: 0.060000
> 
> > The other odd thing here is that Type3 is faster than Type2, even
> > though it actually does some computation inside the type.
> 
> Now, type3 even beats type1... what's going on?
> 
> -- 
> MrTrick
> 

Try rearranging your code. I suspect the time discrepency between the 
first 3 is simply to do cpu load.
Try running type3, type1, type2.

Chris Bensler
Code is Alchemy

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu