>>>The last point is probably compiler dependent. GCC has the tendency >>>to use the same layout for the assembler code as you use in the >>>C source code, so placing often used code close to the top >>>results in better locality (at least on my machines). >> >> My experience with gcc (on x86) is that it uses a lookup table >> for contiguous switch statements rather than a long chain of >> compares/branches. A quick look at the assembler output from ceval.c >> suggests it's using a lookup table. > >Right, but the code for the case implementations itself is >ordered (more or less) in the order you use in the C file. At >least that was the case at the time (which must have been GCC >2.95.x or even earlier). Yeah - I think I must have been reading too fast - on second reading, you clearly said "locality". -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4