Re: Euphoria bug
- Posted by Robert Craig <rds at RapidEuphoria.com> Sep 14, 2005
- 538 views
Bob Thompson wrote: > --I've been getting a lot of misleading results during benchmarking > --of various large structures which prompted an investigation. > --The following example shows an anomaly I found. > --Run the programme with and without releasing the commented loop(s) > --and note the speed of the loops. 1D structures are fast and behave normally. > > sequence s > atom t > object data > constant repeats = 1000000, len = 1000 > > s = repeat(repeat({}, len), len) > > -- --this loop always appears to be fast and speeds up all following loops > -- t = time() > -- for n = 1 to repeats do > -- s[length(s)][length(s)] = {3333, 7777} > -- data = s[length(s)][length(s)] > -- end for > -- ?time()-t > > -- t = time() > -- for n = 1 to repeats do > -- s[999][999] = {3333, 7777} > -- data = s[999][999] > -- end for > -- ?time()-t > > t = time()--identical to the second loop > for n = 1 to repeats do > s[999][999] = {3333, 7777} > data = s[999][999] > end for > ?time()-t > > machine_proc(26,0) Thanks for reporting it. I've duplicated the problem on my machine. It seems that almost any change you make can cause it to run fast. I haven't had time to track it down, but working with a stripped down version suggested by Matt Lewis, I found that simply changing: data = s[999][999] to: data = s[998][999] Makes it fast.
sequence s atom t object data constant repeats = 1000000, len = 1000 s = repeat(repeat({}, len), len) -- s[1][1] = 0 -- makes it fast - Matt Lewis t = time()--identical to the second loop for n = 1 to repeats do s[999][999] = {1, 1} data = s[999][999] -- data = s[998][999] -- makes it fast end for ?time()-t
This makes me think there might be a quirky situation here to do with reference counts, that causes a sequence to be copied on overwrite (slow case) or not copied (fast case). It's getting late. I'll investigate it tomorrow. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com