> From: M.-A. Lemburg [mailto:mal@lemburg.com] > > Back in the 1.5.2 days I played a lot with the ceval loop and > the best results I got came from: > > a) moving the LOAD_FAST opcode out of the switch Are you suggesting a test for LOAD_FAST before the switch, e.g. if (opcode == LOAD_FAST) { // load fast } else switch (opcode) { // body } > b) splitting the switch statement in two: the first one for > more commonly used opcodes, the second one for less often > used opcodes Are you suggesting something like: switch (opcode) { case COMMON_OP: case COMMON_OP: ... default: switch (opcode) { case UNCOMMON_OP: case UNCOMMON_OP: } Or something like this: switch (opcode) { case COMMON_OP: case COMMON_OP: ... default: handle_uncommon_ops(); } > c) ordering cases in the switch statements by usage frequency > (using average opcode usage frequencs obtained by > instrumenting the interpreter) I might try a little simulated annealing to generate layouts with high frequency opcodes near the front and coorcurring opcodes near each other. > 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).
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