@UncombedCoconut one month later, but thanks a lot for trying some numbers (in addition to fixing the issue in the first place)! I'll see if I can find the time to measure it a tiny bit more consistently (inserting a timer around the relevant parts), but your numbers suggest that #2747 isn't useful anymore (which, despite the effort I put into, I'd be happy to get rid of). Anyway, it doesn't seem like having it in slows anything down measurably, so there's no hurry -- but not remembering what it was all about.
IMO, procrastination was a wise choice: A tested, known-good version 1.38 got released, and the Scintilla version on master is about to be 5.1.x. Once that's merged, I think it makes sense to re-test whether a backout of #2747 has any effect on performance.