Re: Type-checking performance
- Posted by Patrick Barnes <mrtrick at gmail.com> Feb 01, 2005
- 457 views
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