Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 43784:8fcc3f46c69d legacy-trunk
Add build option for faster loop execution.
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Wed, 07 Nov 2007 02:45:46 +0000 |
| parents | dc39dddea330 |
| children | 76844a0a579f |
line wrap: on
line diff
--- a/Python/ceval.c Wed Nov 07 02:26:17 2007 +0000 +++ b/Python/ceval.c Wed Nov 07 02:45:46 2007 +0000 @@ -2159,7 +2159,18 @@ PREDICTED_WITH_ARG(JUMP_ABSOLUTE); case JUMP_ABSOLUTE: JUMPTO(oparg); +#if FAST_LOOPS + /* Enabling this path speeds-up all while and for-loops by bypassing + the per-loop checks for signals. By default, this should be turned-off + because it prevents detection of a control-break in tight loops like + "while 1: pass". Compile with this option turned-on when you need + the speed-up and do not need break checking inside tight loops (ones + that contain only instructions ending with goto fast_next_opcode). + */ + goto fast_next_opcode; +#else continue; +#endif case GET_ITER: /* before: [obj]; after [getiter(obj)] */
