flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 27 Jun 2010, 10:37
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 27 Jun 2010, 10:40
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 27 Jun 2010, 10:49
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 27 Jun 2010, 11:03
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 27 Jun 2010, 11:16
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 27 Jun 2010, 11:23
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 27 Jun 2010, 11:28
I never seen any winapi code play behind the RIP before?
|
|||
![]() |
|
revolution 29 Jun 2010, 11:27
bitshifter wrote: I never seen any winapi code play behind the RIP before? |
|||
![]() |
|
r22 30 Jun 2010, 16:08
You forgot to align the MainLoop label to 16bytes.
|
|||
![]() |
|
ass0 30 Jun 2010, 17:58
why?
_________________ ![]() Nombre: Aquiles Castro. Location2: about:robots |
|||
![]() |
|
baldr 30 Jun 2010, 23:52
ass0,
Cache fill after miss after jmp MainLoop will probably perform better. |
|||
![]() |
|
ass0 01 Jul 2010, 00:26
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 01 Jul 2010, 01:13
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 01 Jul 2010, 01:16
wow!
_________________ ![]() Nombre: Aquiles Castro. Location2: about:robots |
|||
![]() |
|
asmfan 01 Jul 2010, 07:18
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 01 Jul 2010, 22:09
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.