When flyspell-mode is enabled in a big html file, and point is somewhere near the end of the buffer, typing text or moving point with C-f and C-b become sluggish, to the point of being nearly unusable. (This is a regression from emacs 22, where flyspell-mode was fine on such files.) I expect "big file" is relative to cpu speed, but 300 kbytes is bad on my slow pc (not an outrageously huge file). To reproduce try this of about 600 kbytes, (progn (switch-to-buffer "foo") (dotimes (i 50000) (insert (format "

abc def\n" i))) (html-mode) (flyspell-mode)) It takes a few seconds to create the buffer, but of course that's not the bug. The bad bit is if you move point around with C-f / C-b near the end of the buffer, or type some plain text there outside of a , where it's sluggish between keystrokes. (Try upping the 50000 on a fast cpu if necessary.) I track the slowness to where `sgml-mode-flyspell-verify' does (looking-back "<[^>\n]*") I take it this func is asking whether point is within a or not. Does that regexp end up asking re-search-backward to consider every "<" in the buffer or something, before deciding no match is possible? I find it hugely faster to do an old fashioned skip-chars-backward as below -- assuming I'm not mistaken that the "\n" in the existing `looking-back' is supposed mean examining no more than the current line. 2009-09-21 Kevin Ryde * textmodes/flyspell.el (sgml-mode-flyspell-verify): Use skip-chars-backward instead of looking-back, to avoid a very slow regexp match when far into a big buffer with a lots of "<" chars.