[32971] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4247 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 8 06:09:15 2014

Date: Tue, 8 Jul 2014 03:09:02 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 8 Jul 2014     Volume: 11 Number: 4247

Today's topics:
    Re: Cost of qr// vs m// <hjp-usenet3@hjp.at>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 8 Jul 2014 11:57:42 +0200
From: "Peter J. Holzer" <hjp-usenet3@hjp.at>
Subject: Re: Cost of qr// vs m//
Message-Id: <slrnlrng4m.9c4.hjp-usenet3@hrunkner.hjp.at>

On 2014-07-06 23:08, Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
> On 2014-03-28, Rainer Weikusat <rweikusat@mobileactivedefense.com> wrote:
>> This mystery is easily explained when looking the the decompiled/
>> disassembled internal represention (I've omitted everything except the
>> actual loop). 'live' becomes
>
> I do not see how it explains anything…
[...]
>> For the qr'ed case, it actually calls into the top-level regexp compiler
>> routine (pp_regcomp) on each iteration which gets the already compiled
>> regexp out of the passed argument in case contained a (reference) to an
>                                           ^^^^ it
>> already compiled regexp instead of calling the 'real' regexp compiler.
>> Judging from the (5.10.1) C-code, the compiled regexp is also copied to
>> 'a temporary object' for each match.
>
> With 5.8.8 (the last version for which I bear some responsibility),
> the timing is
>   qr	 2.28
>   q	 2.19
>   inline 1.78
[...]
> *This* is reasonable, and matches what I intended with qr//.

It's much better than the current behaviour, but reusing the precompiled
regex is still *slower* than just recompiling the regex every time. I
thought the intention was to be faster - ideally almost as fast an
inline regexp.

(Of course /some/ is an atypically simple regex, the results may be
different with a more complex regex).

        hp

-- 
   _  | Peter J. Holzer    | Fluch der elektronischen Textverarbeitung:
|_|_) |                    | Man feilt solange an seinen Text um, bis
| |   | hjp@hjp.at         | die Satzbestandteile des Satzes nicht mehr
__/   | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 4247
***************************************


home help back first fref pref prev next nref lref last post