View Single Post
Old 13th July 2004, 20:44   #14
Major Dude
TomyLobo's Avatar
Join Date: Feb 2004
Location: Germany
Posts: 580
about the speed difference between using megabuf() and if/equal/bnot/whatever:
megabuf() is most probably faster in terms of memory access because it accesses memory only 4 times:
1. fetch the index (if it isnt already in the fpu from previous calculations) (prolly fld [e*x])

2. store the index to a temporary integer (fist [ebp+/-something])

3. put the index into a cpu register (mov e*x, [ebp+/-something])

4. get the value from the megabuf using that index and the base address of the megabuf (fld [e*x+e*x])

that would be a complexity of 4 which is a constant cost while using if()s, equal()s or bnot()s would require a linear amount of time which would be slower if you have more than 3 or 4 or so...

If you can't say something nice, say something surrealistic.
TomyLobo is offline   Reply With Quote