Re: which is faster?
- Posted by egg <egege at rambler.ru> May 08, 2007
- 663 views
sorry, there was a mistake It must done so: include sort.e include machine.e include misc.e include get.e include graphics.e atom start,finish integer cycles,x,y sequence s,t,a s = "Yes" t = "No" cycles = 10000000 puts(1,"Start...\n") function won_lost1(sequence a,sequence b) if equal(a,b) then return "Won" end if return "Lost" end function -------------------------or----------------------- function won_lost2(sequence a,sequence b) if equal(a,b) then return "Won" else return "Lost" end if end function start = time() for i=1 to cycles do --construction1 a = won_lost1(s,t) end for finish = time() - start position(23,2) printf(1,"time1 = %f sec\n ",finish) start = time() for i=1 to cycles do --construction2 a = won_lost2(s,t) end for finish = time() - start printf(1,"time2 = %f sec\n",finish) x = wait_key()