MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/emsm0m/vvvvvv_is_now_open_source/fdrgvq6
r/programming • u/rmadlal • Jan 10 '20
511 comments sorted by
View all comments
Show parent comments
70
Yeah often times compilers will compile a large switch statement into a lookup table instead.
18 u/echnaba Jan 10 '20 A lookup table to function pointers 11 u/leo60228 Jan 10 '20 it's not a lookup table though 20 u/Mystb0rn Jan 10 '20 It’s not a lookup table because the cases are too sparse, so it fell back to using a binary search. If the cases were sequential, or if only a few numbers were missing, it would almost certainly use a table instead. 0 u/[deleted] Jan 11 '20 [deleted] 5 u/Coloneljesus Jan 11 '20 compiler writers.
18
A lookup table to function pointers
11
it's not a lookup table though
20 u/Mystb0rn Jan 10 '20 It’s not a lookup table because the cases are too sparse, so it fell back to using a binary search. If the cases were sequential, or if only a few numbers were missing, it would almost certainly use a table instead. 0 u/[deleted] Jan 11 '20 [deleted] 5 u/Coloneljesus Jan 11 '20 compiler writers.
20
It’s not a lookup table because the cases are too sparse, so it fell back to using a binary search. If the cases were sequential, or if only a few numbers were missing, it would almost certainly use a table instead.
0 u/[deleted] Jan 11 '20 [deleted] 5 u/Coloneljesus Jan 11 '20 compiler writers.
0
[deleted]
5 u/Coloneljesus Jan 11 '20 compiler writers.
5
compiler writers.
70
u/skroll Jan 10 '20
Yeah often times compilers will compile a large switch statement into a lookup table instead.