Poked to death

new topic     » topic index » view thread      » older message » newer message

Allright.
All yall that want to make Euphoria burn rubber and kick VC++'s ass when it
comes to speed, try this.

When you need to store some crap in one place, don't create a sequence .
When you have something like this to do:

sequence one_to_thousand
one_to_thousand = {}

for ix = 1 to 1000 do
    one_to_thousand &= ix
end for

Don't use a sequence.
Do it like this:

integer one_to_thousand
one_to_thousand = allocate(1000*4)  -- 4 = 4 bytes per number

for ix = 1 to 1000 do
    poke4(one_to_thousand+ix,ix)
end for

You think this ain't gonna gain speed huh?
Well the ratio between using the sequence, and using the pokes, is
1 to 7 (ie. 7 times faster).
Try it out, use "arrays" in memory when comparing speeds with compiled
C/C++, you will be surprised (C/C++ is only 3 times faster instead of 10
times).


Mike The Spike
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu