encyclopegia.org

Jump threading

In computing, jump threading is a compiler optimization of one jump directly to a second jump. If the second condition is a subset or inverse of the first, it can be eliminated, or threaded through the first jump. This is easily done in a single pass through the program, following acyclic chained jumps until the compiler arrives at a fixed point.

In computing, jump threading is a compiler optimization of one jump directly to a second jump. If the second condition is a subset or inverse of the first, it can be eliminated, or threaded through the first jump. This is easily done in a single pass through the program, following acyclic chained jumps until the compiler arrives at a fixed point. ==Benefits== The primary benefit of jump threading is the reduction of the amount of dynamically executed jumps. This makes way for further optimizations as there is a decrease in the number of conditionals, which will improve performance. On average one can expect 2-3 instructions being omitted as a result from a successful removal of a runtime branch. ==Examples== The following pseudocode demonstrates when a jump may be threaded. 10. a = SomeNumber(); 20. IF a > 10 GOTO 50 ... 50. IF a > 0 GOTO 100 ... The jump on line 50 will always be taken if the jump on line 20 is taken. Therefore, for as long as line 100 is within the reachable range of the jump (or the size of the jump doesn't matter), the jump on line 20 may safely be modified to jump directly to line 100. Another example shows jump threading of 2 partial overlap conditions: void baz(bool x, bool y, bool z) { if (x && y) bar(); if (y || z) foo(); } The above can be transformed into: void baz(bool x, bool y, bool z) { if (x && y) { bar(); goto jmp; } if (y || z) { jmp: foo(); } } If the first branch is taken, x and y are both true (logical conjunction), hence evaluation of expression y || z is not needed (logical disjunction). Therefore, a jump to label jmp is performed. ==See also== Switch (programming) Spaghetti code ==References==

References

  1. Optimize Options - Using the GNU Compiler Collection (GCC) · retrieved 2026-11-19 · rev 1337508978
    Cite this reference

    MLA "Optimize Options - Using the GNU Compiler Collection (GCC)." 2026-11-19. https://gcc.gnu.org/onlinedocs/gcc-3.4.5/gcc/Optimize-Options.html. Accessed 24 November 2026.

    Chicago "Optimize Options - Using the GNU Compiler Collection (GCC)." 2026-11-19. https://gcc.gnu.org/onlinedocs/gcc-3.4.5/gcc/Optimize-Options.html.

    APA encyclopegia.org. (2026). Optimize Options - Using the GNU Compiler Collection (GCC). Retrieved November 24, 2026, from https://gcc.gnu.org/onlinedocs/gcc-3.4.5/gcc/Optimize-Options.html

  2. A gentle introduction to jump threading optimizations | Red Hat Developer · retrieved 2023-01-07 · rev 1337508978
    Cite this reference

    MLA "A gentle introduction to jump threading optimizations | Red Hat Developer." a b "A gentle introduction to jump threading optimizations | Red Hat Developer". 2023-01-07. https://developers.redhat.com/blog/2019/03/13/intro-jump-threading-optimizations. Accessed 24 November 2026.

    Chicago "A gentle introduction to jump threading optimizations | Red Hat Developer." a b "A gentle introduction to jump threading optimizations | Red Hat Developer". 2023-01-07. https://developers.redhat.com/blog/2019/03/13/intro-jump-threading-optimizations.

    APA a b "A gentle introduction to jump threading optimizations | Red Hat Developer". (2023). A gentle introduction to jump threading optimizations | Red Hat Developer. Retrieved November 24, 2026, from https://developers.redhat.com/blog/2019/03/13/intro-jump-threading-optimizations

Cite this article

MLA

"Jump threading." encyclopegia.org, 2026, https://encyclopegia.org/wiki/jump-threading. Accessed 24 November 2026.

Chicago

"Jump threading." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/jump-threading.

APA

encyclopegia.org. (2026). Jump threading. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/jump-threading

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Related articles

Ultra Jump

stub · references available

Jump

stub · references available

Jump (For My Love)

stub · references available

Jump In!

stub · references available

axel jump

stub · references available
CC BY-SA 4.0 · tier1-factual · https://en.wikipedia.org/w/index.php?oldid=1337508978 · 0.55 · snapshot jump-threading-715077-6b25fb857ef13907 · QID Q6311209

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.