hi there,

i have a little small and stupid question too probably, but when i look up these 2 commands add/inc/sub or all those other commands in my masm32/help/opcodes.hlp file then all the instructions are for >486 just 1 millisecond.?!

So is it true that when you work on a pentium you don't have to care about the faster instruction inc eax rather than add eax,1??

In the past it was a bad habbit to do so, is this still true?

i hope you understand what i mean?

Thanx:))
Posted on 2002-08-01 04:22:10 by eisodur
A millisecond is a loooooooong time for a computer.
I care about it :)
Posted on 2002-08-01 04:35:23 by bazik
A millisecond is forever! The hardware engineers at work are getting worked up when their units are 200 pico-seconds off the target time!

Its true that in terms of execution time add eax, 1 takes the same time as inc eax, but there is more to it than that. The size of the operation will matter if you are in a loop. If you can squeeze the loop down a bit, so it fits on one cache line, then there is can be a (big) speed improvement.

Mirno
Posted on 2002-08-01 04:39:08 by Mirno
The times listed in the opcode reference aren't in milliseconds, but in clockcycles, so on a 500MHz machine inc eax would take 1/500,000,000 seconds or only 0,000002 milliseconds.
Posted on 2002-08-01 08:02:48 by _js_
Mirno is right, size of loop code can in some instances determine how fast the loop code is but as usual, its the sequence of instructions that matter. From about Pentium MMX onwards, the efficiency of dual pipelines makes cycle counting and then adding them up redundant, it is what you can get through dual pipelines that determine how fast an algorithm runs.

Funny enough, the circuitry for the P4 is supposed to work better with add reg, 1 than inc reg but I have the suspicion that it will still depend on the actual sequence of instructions.

Regards,

hutch@movsd.com
Posted on 2002-08-01 10:49:59 by hutch--