I was planning on replacing some register loading
mov eax, dwNumber1
mov dwNumber2, eax
with push and pops to save some clock cycles. When I looked it up in the Masm reference material, probably reading it wrong,
I read it as
mov reg,mem 1 cycle
push or pop 3 cycles
just curious Thanks
this cycles have no any reference to real velocity of read/write to memory. through register it much quickly
(http://xmages.net/storage/10/1/0/d/1/upload/bb8703b7.png)
(http://xmages.net/storage/10/1/0/d/1/upload/d19e8282.png)
(http://xmages.net/storage/10/1/0/d/1/upload/c804dd06.png)
as you may see through memory needs more than 30 000 cycles. all you may rightly use memory cache
I made a liitle program for myself which exclude double http addresses from big list - 19 000 addresses long . My first application do this 8 minutes, after apply modern algorithm and all investigations with ticks I do this - 0.3 sec
Making video need computer recourses
(http://xmages.net/storage/10/1/0/8/9/upload/80ffab2d.gif)
any push-pop, any inc-dec, any lodsb-stosb, any loop,...
Depends on the CPU and the bus. On a Celeron M, a push mem/pop mem pair needs 6 cycles, against 2 cycles for a mem2reg, reg2mem pair. However, that is for cached memory. The difference is much smaller for non-cached memory. Below, the first two rows are for 1000 bytes each, the kCycles for 8,000,000, i.e. non-cached memory. In practice, the differences are irrelevant.
Intel(R) Celeron(R) M CPU 420 @ 1.60GHz (SSE3)
1521 cycles for push+pop
520 cycles for mov+mov
13768 kCycles for push+pop
13050 kCycles for mov+mov
11977 kCycles for rep movsd
1519 cycles for push+pop
523 cycles for mov+mov
13692 kCycles for push+pop
13056 kCycles for mov+mov
11977 kCycles for rep movsd
a little surprising, actually
i thought PUSH/POP was faster on this CPU :P
(i mean faster than the measurement - not faster than MOV/MOV)
prescott w/htt
Intel(R) Pentium(R) 4 CPU 3.00GHz (SSE3)
3089 cycles for push+pop
602 cycles for mov+mov
25425 kCycles for push+pop
21472 kCycles for mov+mov
22708 kCycles for rep movsd
3122 cycles for push+pop
601 cycles for mov+mov
25104 kCycles for push+pop
21593 kCycles for mov+mov
22652 kCycles for rep movsd
Quote from: Don57 on June 28, 2011, 05:39:07 PM
When I looked it up in the Masm reference material, probably reading it wrong,
I read it as
mov reg,mem 1 cycle
push or pop 3 cycles
Those cycle counts are probably from somewhere around the 486 era, too far back to be meaningful today.