[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#44861: 27.1; [PATCH] signal in `replace-regexp-in-string'

From: Mattias Engdegård
Subject: bug#44861: 27.1; [PATCH] signal in `replace-regexp-in-string'
Date: Thu, 26 Nov 2020 13:57:59 +0100

25 nov. 2020 kl. 22.39 skrev Stefan Kangas <stefankangas@gmail.com>:

> I personally worry about the performance here.  Since we use regexps
> heavily all over, it is not clear (to me) that 10 % overall performance
> drop with subexpressions is worth it to work correctly in these rare
> edge-cases.  I suppose we do have to fix the bug here, but is it
> feasible to solve this in a way that has less performance impact?

We can't really let it remain buggy, especially as the consequence can be an 
error or silently wrong results. Also remember that one man's edge case is 
another's reasonable use.

However, unlike Boris we can eat our cake and have it! The attached patch 
performs the match-data translation in a C function, which obviously is much 
faster and indeed speeds up replace-regexp-in-string in all cases (as long as 
there is any match at all). The new primitive is a bit ad-hoc, but does one 
well-defined thing and isn't intended for use by the general public anyway.

Attachment: 0001-Fix-replace-regexp-in-string-substring-match-data-tr.patch
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]