flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution
How do you know if it is faster than other code?
Have you seen the code executed by the OS when you call PeekMessage? You have no delay in your loop so it will use full CPU resources while achieving nothing. Perhaps you should consider giving time to other tasks to do the things that you are waiting for? |
|||
![]() |
|
bitshifter
It has to be faster since we are using less instructions from the inner loop.
And yeah, it was meant to be a total resource hog ![]() |
|||
![]() |
|
revolution
bitshifter wrote: It has to be faster since we are using less instructions from the inner loop. ![]() bitshifter wrote: And yeah, it was meant to be a total resource hog |
|||
![]() |
|
bitshifter
Basically i traded pushing 5 parameters each iteration for one subtraction.
In my book, thats always faster... Its for a single threaded demo loop, not a normal application. |
|||
![]() |
|
revolution
bitshifter wrote: Basically i traded pushing 5 parameters each iteration for one subtraction. bitshifter wrote: Its for a single threaded demo loop, not a normal application. |
|||
![]() |
|
revolution
One thing to note here is that Windows does not guarantee to leave the stack parameters untouched. The values may have been changed:
Code: MainLoop: call [PeekMessage] sub esp,20 ;<--- the values may have been changed! test eax,eax jz MainLoop |
|||
![]() |
|
bitshifter
I never seen any winapi code play behind the RIP before?
|
|||
![]() |
|
revolution
bitshifter wrote: I never seen any winapi code play behind the RIP before? |
|||
![]() |
|
r22
You forgot to align the MainLoop label to 16bytes.
|
|||
![]() |
|
ass0
why?
_________________ ![]() Nombre: Aquiles Castro. Location2: about:robots |
|||
![]() |
|
baldr
ass0,
Cache fill after miss after jmp MainLoop will probably perform better. |
|||
![]() |
|
ass0
huh? but how it will filled? with several nop to reach the 16th byte?
In that case, processing each nop takes 1 cycle, then where is the needed to align? Without to mention the file size grows. _________________ ![]() Nombre: Aquiles Castro. Location2: about:robots |
|||
![]() |
|
LocoDelAssembly
ass0, but those NOPs will be executed only once in the entire program run, the remaining N-1 iterations of the loop will skip those NOPs.
Quote: Without to mention the file size grows. |
|||
![]() |
|
ass0
wow!
_________________ ![]() Nombre: Aquiles Castro. Location2: about:robots |
|||
![]() |
|
asmfan
This isn't bottleneck.
The bottleneck is message processing not picking: Processing by: 1. jumptables (sequential) 2. message frequency analysis (sequential but more efficient) 3. binary trees on message processing (non-sequential long-time ago implemented by c/c++ compilers) And I doubt about reusing used parameters unless some API states that it's func (const param). Anyway doesn't worth optimization at all. |
|||
![]() |
|
f0dder
As mentioned before, you definitely shouldn't re-use stack parameters. I haven't bumped into cases where API calls modify stack parms, and there might be Microsoft coding guidelines against it - but the day it happens, you'll be pretty sorry.
Also, please stop doing CPU-greedy MessageLoops like the one above... there's really no reason to do it, and it sucks wrt. conserving laptop battery. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.