flat assembler
Message board for the users of flat assembler.
Index
> Windows > What!? Why does this happen.... |
Author |
|
rugxulo 26 Mar 2008, 22:26
Instruction pairing? What cpu type and specific OS flavor are you running?
|
|||
26 Mar 2008, 22:26 |
|
AlexP 26 Mar 2008, 23:33
Just a wild guess, but maybe it was just enough to make the prediction work better , check alignment of loop too. Other than that, no clue.
|
|||
26 Mar 2008, 23:33 |
|
revolution 27 Mar 2008, 01:24
Optimising for speed is always problematic with very tight loops. There are so many things that can affect the loop timing. Alignment in memory, number of instructions in the loop, CPU version, memory usage pattern, etc.
Out-of-order CPU's are very complex and to properly make sure you have really optimised a piece of code the only way to be sure is run it in many different code variants on many different system variants and compare the timings. But the example above is of course useless and will tell you nothing about what to expect for a genuine function that actually does something useful. |
|||
27 Mar 2008, 01:24 |
|
AlexP 27 Mar 2008, 01:34
Quote: But the example above is of course useless and will tell you nothing about what to expect for a genuine function that actually does something useful. |
|||
27 Mar 2008, 01:34 |
|
r22 27 Mar 2008, 23:09
Quote:
To a modern processor is just ... Quote:
Thanks to dependency checking/optimizations and pipelines etc. Now add eax,1 mov [counter],eax Has a partial stale because ADD is modifying eax and then MOV is writing it to memory. The processor has to wait for the ADD to finish before it can perform the MOV (in general don't start ripping this on semantics). This stale doesn't exist in add eax,1 mov [counter],ecx The process can perform these two opcodes at the same time, because they are mutually exclusive. Also it's not a loop alignment issue because the label .theLoop: would represent the same memory location in both programs. |
|||
27 Mar 2008, 23:09 |
|
daniel.lewis 28 Mar 2008, 08:01
Hrmm....
moving/adding/subbing things into eax has a shortcut form that takes fewer bytes, but this is out of eax, not into it. :p |
|||
28 Mar 2008, 08:01 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.