Timeline for Is it possible to define branches which, once taken once, will become the default forever?
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 3, 2017 at 21:06 | history | edited | Nat | CC BY-SA 3.0 |
added 438 characters in body
|
May 31, 2017 at 9:00 | history | edited | Nat | CC BY-SA 3.0 |
added 194 characters in body
|
May 31, 2017 at 7:32 | history | edited | Nat | CC BY-SA 3.0 |
added 2652 characters in body
|
May 30, 2017 at 10:36 | comment | added | Nat | @George Actually, pretty sure currying's what you want. Heh, that's good for me, too - I'm selling something that does exactly what you want. =P | |
May 30, 2017 at 10:07 | comment | added | Nat | @George Branch prediction, or just plain currying? First one assumes a path but can backtrack if wrong, the second loses the other paths. | |
May 30, 2017 at 8:41 | comment | added | George | The same problem will be exhibited with a splay tree as well since you still have to do my_tree[x] or at least my_tree.root() to pick the branch that's going to run and in that case which means: a) I have to occupy precious space in L1 while executing the instruction and b) I can't actually load code as efficiently in the cache since the path its going to take it unpredictable. Hence why I was asking if there's a way to write the code such that once a branch is taken the control statement is invalidated and the code becomes linear. | |
May 30, 2017 at 8:39 | comment | added | George | I'm not concerned so much about switch statement being ineficient as I am by the fact that the switch statement exists at all. In the example you gave: var selectedBranch = switchBranches[x]; ... this operation is very resource light but if it happens at a very "hot" point in the program (e.g. each time you append an element to a vector) it will still probably cost you quite a lot of resources on a modern architecture in a real program. | |
May 30, 2017 at 0:44 | history | edited | Nat | CC BY-SA 3.0 |
added 345 characters in body
|
May 30, 2017 at 0:37 | history | edited | Nat | CC BY-SA 3.0 |
added 345 characters in body
|
May 30, 2017 at 0:31 | history | answered | Nat | CC BY-SA 3.0 |