Subject: bug#73563: [Ben Simms] Performance bottleneck in ns_draw_fringe_bitmap

From: Alan Third <[email-masked]>
Date: Sat, 26 Jul 2025 12:06:22 +0100

Thanks, and sorry for the delay, I've pushed my changes to master. If
it doesn't fix the performance issues we can reconsider Ben's patch.

On Fri, Jun 06, 2025 at 07:01:45PM +0900, Jordan Ellis Coppard wrote:
> Here are four screenshots in the same respective order as the videos in
> terms of Emacs version. Unpatched Emacs with dape-mode shows no corruption,
> Ben's patch shows the frame and all it's windows borked (when it should look
> like 1, 3, or 4), your patch shows dape-mode without corruption, and the
> fourth screenshot which is Emacs (3) but with my dotfiles loaded shows the
> small 1-pixel-ish corruption in the margin (look at the fringe for lines
> 1-15). That corruption only appears when I scroll the buffer down and up.
> Whereas Ben's corruption appears immediately and indefinitely unless
> fringe-mode is toggled off.

The corruption looks to me like the fringe bitmap is overflowing into
the main text area. That's why it's not being cleaned up correctly,
because Emacs doesn't expect it to have drawn there.

I'm not sure why that's happening. Perhaps my patch is drawing too far
to the right (but it looks like I'm doing the right thing here...) or
maybe there's a mistake in calculating the boundaries of the fringe.
I can't see anything obviously wrong, so I don't know.

More investigation is required.
-- 
Alan Third