Re: Allocate() Affecting execution speed.
- Posted by Robert Craig <rds at ATTCANADA.NET> Dec 30, 1999
- 443 views
David Guy writes: > What am I not seeing? I'm not using the block for anything > so why should that effect the speed of the code? The code that you posted seems to fit the criteria for a performance bug that was fixed for version 2.2 (Win, DOS and Linux). Basically, you are growing and regrowing a sequence over and over. When I run your code under 2.2 Beta I get a time that is 10x faster than under 2.1 on the same machine. I did notice that when the block is allocated the time goes up rather surprisingly on 2.1, and to a much smaller extent on 2.2 Beta. I also noticed that when I allocated *two* 1024-byte blocks instead of just one, the time went back to normal. Since the time only varies by 10% on 2.2 Beta I don't plan to investigate it further. I assume that by allocating the extra block you have changed the order of blocks on malloc's free list, thereby affecting the speed at which malloc can find new blocks to use with the growing sequence. On 2.1, as I recall, some weird and very inefficient stuff happens in this situation, and I don't want to go back and analyze it. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com