I am trying to find articles, books or anything about jumping-free programming (x86 arch). I know that this is generally impossible, but I try to avoid jumping, but gcc uses transitions many times even with built-in func. Encoding only in the assembly is a kind of solution, but writing the equivalent of 1000 lines in C seems like the hellish side before my eyes.
If your jumps are truly random, branch prediction should eliminate most of the overhead.
I would put more effort into optimizing memory access patterns in order to improve locality and reduce cache misses. These days, memory latency is the main bottleneck for performance.
Another good direction is to improve parallelism (using both vectorized SIMD instructions and, if possible, more than one core).
I think you can keep in mind branching. There are several tricks in C to speed up certain operations.
See the hacks bit:
http://www-graphics.stanford.edu/~seander/bithacks.html
, , , . , , . , - , . , .
, , , - , , , - .
- . , . max min. SSE-, , CPU CMOV/FCOMI/FCOMIP/FUCOMI/FUCOMIP ( : , , ., , gamedev.net).
, .
, - , :
, , - - .
, , - . .
, , . , , .
, , .
Someone mentioned conditional movement instructions, there are many conditional instructions on the ARM architecture, but if they are not executed, they will switch to NOP and go through one cycle. Not sure how they work on x86. This can slow down using a simple branch depending on how long the pipeline is running.
There are many other optimization tricks you could try before deleting branches.
Source: https://habr.com/ru/post/1777426/More articles:static instance in PHP - phpClosing a file without using - c #https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1777423/wrapping-calls-to-mallocrealloc-is-this-a-good-idea&usg=ALkJrhiSTQzUir5Sb50RxTR9JAM-P15UxQHow can I change the href anchors after clicking it? - javascriptWhy am I losing a new line character when loading text from a Java servlet in JTextPane? - javaWhat does symmetry mean when building Real vs Imaginary Components FFT of the periodic time series - mathВызов Scala из Groovy: как обрабатывать разные типы коллекций? - scalaWhat is it? to groovy variables? - grailsSpring validation: cannot convert from String to Date - springDatabase Synchronization Mirroring / Replication / Logging - sql-server-2008All Articles