flat assembler
Message board for the users of flat assembler.
Index
> Windows > How do I read a file byte by byte?Goto page Previous 1, 2 |
| Author |
|
|
Roman 27 May 2020, 12:39
I heard jmp and jr knocks down CPU conveyor
Good do one jr or jmp. Bad method do more then one jmp\jnz\jz\jae\jbe |
|||
|
|
bitRAKE 27 May 2020, 13:19
Study the BTB (Branch Target/Tag Buffer) it's how the processor predicts where to go next. Multiple Jcc close together can be a performance problem - as far as I can remember JMP has no penalty 100% predicted obviously.
_________________ ¯\(°_o)/¯ AI may [not] have aided with the above reply. |
|||
|
|
revolution 27 May 2020, 13:35
Forget about trying to predict what the BTB predictor will do.
Test your code to see what happens when it runs for real. No need to guess, when you can know for sure by running it and seeing what happens. |
|||
|
|
bitRAKE 27 May 2020, 15:00
It was more about branch locality than trying to predict the processor. There are a limited number of bits to indicate where the Jcc instruction is. If there are too many branches in a small region of memory this can artificially slow things down.
All this is very academic at the extreme edge of optimization. _________________ ¯\(°_o)/¯ AI may [not] have aided with the above reply. |
|||
|
|
bitRAKE 29 May 2020, 01:28
As a concrete example, assume we want to execute some function, but only if a file/folder exists:
Code: lea rcx,[folderW] call [GetFileAttributesW] test eax,FILE_ATTRIBUTE_DIRECTORY lea ecx,[rax+2] ; check for error INVALID_FILE_ATTRIBUTES loopnz execute_function_on_folder ; fall through for multiple error conditions _________________ ¯\(°_o)/¯ AI may [not] have aided with the above reply. |
|||
|
|
Roman 30 May 2020, 06:18
I read https://www.agner.org/optimize/instruction_tables.pdf
Call far take 16-22 CPU cycles (for modern CPU its about 16 nanoseconds) JMP far take 16-20 CPU cycles Jcc take 1-2 CPU cycles Question in Fasm 64 bit invoke do far Call ? |
|||
|
|
revolution 30 May 2020, 06:38
Roman wrote: I read https://www.agner.org/optimize/instruction_tables.pdf |
|||
|
|
Furs 30 May 2020, 15:00
Actually aren't far calls used to switch between 32-bit and 64-bit code?
|
|||
|
|
Ali.Z 30 May 2020, 18:36
Furs wrote: Actually aren't far calls used to switch between 32-bit and 64-bit code? so does far jmps. _________________ Asm For Wise Humans |
|||
|
|
Roman 30 May 2020, 19:21
|
|||
|
| Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.