Content deleted Content added
Stevebroshar (talk | contribs) →Sparse one-dimensional array: Edit for brevity |
Stevebroshar (talk | contribs) →Branch tables: Edit for brevity |
||
Line 55:
In automata-based programming and [[pseudoconversational transaction]] processing, if the number of distinct program states is small, a "dense sequence" control variable can be used to efficiently dictate the entire flow of the main program loop.
===Branch
A [[branch table]] is a one-dimensional
▲A [[branch table]] is a one-dimensional 'array' of contiguous [[machine code]] [[branch (computer science)|branch/jump]] instructions to effect a [[multiway branch]] to a program label when branched into by an immediately preceding, and indexed branch. It is sometimes generated by an [[optimizing compiler]] to execute a [[switch statement]] – provided that the input range is small and dense, with few gaps.<ref>http://www.netrino.com/node/137</ref> (as created by the previous array example)
Although quite compact – compared to the multiple equivalent <code>If</code> statements – the branch instructions still carry some redundancy, since the branch [[opcode]] and condition code mask are repeated alongside the branch offsets. Control tables containing only the offsets to the program labels can be constructed to overcome this redundancy (at least in assembly languages) and yet requiring only minor execution time [[computational overhead |overhead]] compared to a conventional branch table.
===Multi-dimensional tables===
|