Re: Out of memory
- Posted by Bob Thompson <rthompson at rthompson.karoo.co.uk> Nov 20, 2005
- 615 views
Nothing too sinister using pre-allocation, Rob. I achieved 1.64 GB before the programme ran out of memory, i.e., atom t sequence s constant repeats = 410000000--s needs 1.640000024 GB s = repeat({}, repeats) t = time() for n = 1 to repeats do s[n] = n end for ?time() -t machine_proc(26,0) Perhaps it's better to use pre-allocation for all large sequences, even where its final length is unknown, by pre-allocating in blocks as, I suspect, Euphoria does. Thanks. As an aside, and maybe of interest to others, I carried out a few basic trials comparing the performance of the Athlon 1700+ with that of the Pentium 3.4 HT CPU for a single programme, and for two programmes running simultaneously, since the Pentium only uses 50% processing power on a single programme, i.e. -------------------------------- --saved as main.exw constant shells = 2 for n = 1 to shells do system("start test_prog.exw", 2) end for -------------------------------- --saved as test_prog.exw atom t sequence s constant repeats = 10000000, rounds = 10 s = repeat({}, repeats) t = time() for m = 1 to rounds do for n = 1 to repeats do s[n] = n end for end for ?time() -t machine_proc(26,0) -------------------------------- Average of 4 runs. For a single programme running, Athlon 1.85 sec. Pentium 0.95 sec. (95% faster) For two programmes running, Athlon 3.55 and 3.55 sec. Pentium 1.40 and 1.42 sec. (152% faster) Expressed differently, the Athlon executed two programmes simultaneously in 1.92 times the time it took to execute one, whereas the Pentium HT took 1.48 times longer for two than it took for one - significant enough to consider non (or loosely synchronised) background programme activities such as music, interfaces etc. with communication through memshare or equivalent. Regards, Bob