GNU bug report logs -
#77942
31.0.50; replace-region-contents gets stuck
Previous Next
Full log
Message #59 received at 77942 <at> debbugs.gnu.org (full text, mbox):
Gerd Möllmann [2025-04-22 05:48:14] wrote:
> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> Gerd, IIUC you're trying to use this to benchmark the charpos->bytepos
>> code, in which case you should be better served by a call where the text
>> and its replacement are of fairly similar size.
>
> That's right, it's for a bencnmark that helps me to get an impression if
> avoiding the binary search in the charpos -> bytepos case is worth it.
> Now that I know what replace-region-contents does, that's no problem.
>
> But honestly, what the heck? Does someone know what this diffing is
> about in the first place? I mean, that replacing a region takes O(ND) is
> not something that I would have thought possible.
That's why I wanted (well, still want) to have a `replace-region` that
does just the plain/stupid/naive replacement, and then keep
`replace-region-contents` as a separate function (ideally even renamed
to something like `replace-region-slowly` or
`replace-region-carefully`).
One place where the diff's extra work is worthwhile is when you do
reindent/prettyprint via an external process.
Stefan
This bug report was last modified 56 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.