Subject: Re: bug#56815: 29.0.50; Isearch lazy-highlight highlights too much when truncate-lines is in effect

From: Gregory Heytings <[email-masked]>
Date: Fri, 29 Jul 2022 19:11:10 +0000

>> The problem is how "visible" is defined here (by 
>> pos-visible-in-window-p). With truncated lines, all buffer positions 
>> between window-start and window-end are "visible", or IOW, all buffer 
>> positions on the left or right of the actually visible line portion are 
>> "visible".
>
> One could use posn-at-point instead.
>

One could, but...

>> Moreover pos-visible-in-window-p is a slow function, so it would be 
>> terribly slow to call it for each candidate position in a buffer with 
>> (tens of) thousands of candidate positions.
>
> I think posn-at-point is much faster,
>

No, it is slower.  On my laptop, with long-line.xml and truncate-lines:

(benchmark-run 1000 (pos-visible-in-window-p 310000)) takes 4 seconds

(benchmark-run 1000 (numberp (cadr (posn-at-point 310000)))) takes 6 seconds