Results for Windows XP with CPPFLAGS='-DGLYPH_DEBUG=1' CFLAGS='-O0 -g3' --enable-checking=yes --enable-check-lisp-object-type=yes: Unmodified xdisp.c from trunk: 24.3 1007 scrolls, total time = 105.60900020599365s. 24.4 1007 scrolls, total time = 73.21900010108948s. 25.0 1007 scrolls, total time = 318.5629997253418s. xdisp.c from trunk with odd apostrophes eradicated: 24.3 1007 scrolls, total time = 100.1240005493164s. 24.4 1007 scrolls, total time = 60.13900017738342s. 25.0 1007 scrolls, total time = 197.95300006866455s. I can't test with older versions since those don't have `scroll-down-command' here. So while it might be worthwhile to do such an optimization, here the great differenece is the 3-to-5-fold increase of execution time from 24.4 to 25.0 for which I don't have an explanation. The cc-mode used is always the one bundled with the respective Emacs version. martin BTW, if you want to quickly visualize constructs like (defconst odd-apostrophes "/\\*\\([^*']\\|\\*+[^*'/]\\)*\\(\\**'\\([^*']\\|\\*+[^*'/]\\)*\\**'\\([^*']\\|\\*+[^*'/]\\)*\\)*\\**\\('\\)\\([^*']\\|\\*+[^*'/]\\)*\\*+/" ) without adding comments like ;; 1 2 3 4 5 6 you can use the regexp-lock.el package I attached here ;-)