It's worth trying to redesign save-restriction and save-excursion to avoid allocating Lisp data. I tried some hacks for save-excursion, and it's quite surprising: initially, running (while t (scroll-up) (sit-for 0.05)) over just loaded xdisp.c with font-lock enabled asks for 600 GCs, and with this patch it's just 350. Dmitry