[Top][All Lists]

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

Re: find-file-noselect needs save-match-data

From: Richard Stallman
Subject: Re: find-file-noselect needs save-match-data
Date: Wed, 06 Jun 2007 18:10:01 -0400

    > Both throw away match-data immediately.  If match-data is expensive why
    > build it in the first place when it's not needed?  Why not make a thing
    > like `fast-string-match' available in Lisp?

    It's not the match data that's expensive.  It's the save-match-data.
    The match-data is built cheaply during the call to string-match in the form
    of a C data structure.  It's only when `match-data' is called that it ends
    up building a Lisp lisp (sometimes with markers to boot).

That is true, but still it might be good to add a variant of
string-match that doesn't alter the match-data.

This function won't be faster than string-match, but it could be a lot
faster than (save-match-data (string-match...)), which is the way
to do this now.

Perhaps the name should be `safe-string-match'.

reply via email to

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