develooper Front page | perl.perl5.porters | Postings from January 2013

COW: big slowdown in simple pattern matches

Thread Next
From:
Dave Mitchell
Date:
January 1, 2013 19:37
Subject:
COW: big slowdown in simple pattern matches
Message ID:
20130101193658.GM2926@iabyn.com
Since the following commit:

    commit cd298ce42eb3c82a651608c3fbd658ec616b0297
    Merge: 08bf00b f5a0fd1
    Author:     Father Chrysostomos <sprout@cpan.org>
    AuthorDate: Tue Nov 27 07:08:08 2012 -0800
    Commit:     Father Chrysostomos <sprout@cpan.org>
    CommitDate: Tue Nov 27 07:08:50 2012 -0800

	[Merge] New COW mechanism

The code below takes about 3 times longer to execute. I haven't looked
into why.

Here are the timings on a -O, non-threaded build, for various points
between 5.17.6 and 5.17.7:

    v5.17.7~204 1.170s
    v5.17.7~227 1.179s
    v5.17.7~238 1.171s
    v5.17.7~244 1.206s
    v5.17.7~247 1.215s
    v5.17.7~248 1.251s <=- this is the COW merge
    v5.17.7~249 0.430s
    v5.17.7~250 0.444s
    v5.17.7~277 0.433s 
    v5.17.7~306 0.456s

and here's the crude benchmark:

    $a = ("-" x 100);
    for (1..100_000) {
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
	$a =~ /---/;
    }


-- 
No man treats a motor car as foolishly as he treats another human being.
When the car will not go, he does not attribute its annoying behaviour to
sin, he does not say, You are a wicked motorcar, and I shall not give you
any more petrol until you go. He attempts to find out what is wrong and
set it right.
    -- Bertrand Russell,
       Has Religion Made Useful Contributions to Civilization?

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About