Allocate() Affecting execution speed.
- Posted by David Guy <dguy at MINDSPRING.COM> Dec 30, 1999
- 470 views
Hi, I have the following piece of code: ----- include get.e include machine.e sequence seq atom misc, start, stop, block block = allocate( 1024 ) start = time() for i = 1 to 20000 do seq = {} for j = 1 to 64 do seq &= {4,5,6} end for end for stop = time() printf(1, "Time: %f\n", (stop - start) ) free(block) misc = wait_key() ----- If I don't allocate the block of memory, on my machine, the above code executes in ~0.5 seconds. If I allocate a block of 1k, and use a value from 38 to 76 in the 'for j' loop the code executes in ~1.2 to ~2.6 seconds. If I use a larger block size and/or use a value outside the range mentioned above, the time the code takes to execute scales as would be expected (i.e. 37 = ~0.32, 77 = ~0.57) What am I not seeing? I'm not using the block for anything so why should that effect the speed of the code? If everything is ok, does anyone have any insight or ideas as to what could be going on inside Euphoria that would be causing the slow down? The PERFORM.DOC talked about the size of the cache possibly affecting speed; could that have something to do with it? I'm using Euphoria 2.1, complete edition. The behavior is the same under Windows 98 and DOS. I have also tested this under the 2.2 beta; the times where different but the behaviour was identical. Thanks in advance, David Guy