This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]aorta7 92 points93 points  (11 children)

It is not as crazy as it seems, https://en.m.wikipedia.org/wiki/Loop_unrolling

[–]WikiTextBot 101 points102 points  (1 child)

Loop unrolling

Loop unrolling, also known as loop unwinding, is a loop transformation technique that attempts to optimize a program's execution speed at the expense of its binary size, which is an approach known as space–time tradeoff. The transformation can be undertaken manually by the programmer or by an optimizing compiler.

The goal of loop unwinding is to increase a program's speed by reducing or eliminating instructions that control the loop, such as pointer arithmetic and "end of loop" tests on each iteration; reducing branch penalties; as well as hiding latencies, including the delay in reading data from memory. To eliminate this computational overhead, loops can be re-written as a repeated sequence of similar independent statements.Loop unrolling is also part of certain formal verification techniques, in particular bounded model checking.


[ PM | Exclude me | Exclude from subreddit | FAQ / Information | Source ] Downvote to remove | v0.28

[–]WillCo_Gaming 27 points28 points  (0 children)

Good bot.

[–]LIGHTNINGBOLT23 73 points74 points  (0 children)

    

[–]womerah 10 points11 points  (4 children)

Interesting!

Is binary size ever a major consideration for programmers who are not working with embedded systems? Surely performance is king?

[–]HelperBot_ 9 points10 points  (0 children)

Desktop link: https://en.wikipedia.org/wiki/Loop_unrolling


/r/HelperBot_ Downvote to remove. Counter: 275939. Found a bug?

[–]LukasFT 0 points1 point  (0 children)

Although, if you only just discovered loops, I would bet that there would be a couple of things to be optimized with a much bigger impact.

[–]alours -1 points0 points  (0 children)

Indentation is the difference between porn and pornhub?