develooper Front page | perl.perl5.porters | Postings from April 2012

[perl #9319] Perl bug -- split function

Thread Previous | Thread Next
From:
bulk 88 via RT
Date:
April 22, 2012 00:07
Subject:
[perl #9319] Perl bug -- split function
Message ID:
rt-3.6.HEAD-4610-1335078415-1682.9319-15-0@perl.org
Hacked NYTProf to profile opcodes aassign padav pushmark split.

Long story short. pp_split or a call fron pp_split is the quadratic problem.

6	1	0s			my $x = "x" x 1000000;
7	1	0s	2	0s	my $time1 = time;
# spent 0s making 1 call to CORE::pushmark 
# spent 0s making 1 call to Time::HiRes::time
8	1	5.08s	5	4.53s	my @a = split //, $x;
# spent 3.83s making 1 call to CORE::split 
# spent 703ms making 1 call to CORE::aassign 
# spent 0s making 1 call to CORE::padav 
# spent 0s making 2 calls to CORE::pushmark, avg 0s/call
9	1	0s	2	0s	my $time2 = time;
# spent 0s making 1 call to CORE::pushmark 
# spent 0s making 1 call to Time::HiRes::time
10	1	531ms	4	531ms	@a = ();
# spent 531ms making 1 call to CORE::aassign 
# spent 0s making 1 call to CORE::padav 
# spent 0s making 2 calls to CORE::pushmark, avg 0s/call


6	1	0s			my $x = "x" x 2000000;
7	1	0s	2	0s	my $time1 = time;
# spent 0s making 1 call to CORE::pushmark 
# spent 0s making 1 call to Time::HiRes::time
8	1	15.7s	5	14.6s	my @a = split //, $x;
# spent 13.3s making 1 call to CORE::split 
# spent 1.38s making 1 call to CORE::aassign 
# spent 0s making 1 call to CORE::padav 
# spent 0s making 2 calls to CORE::pushmark, avg 0s/call
9	1	0s	2	0s	my $time2 = time;
# spent 0s making 1 call to CORE::pushmark 
# spent 0s making 1 call to Time::HiRes::time
10	1	1.06s	4	1.06s	@a = ();
# spent 1.06s making 1 call to CORE::aassign 
# spent 0s making 1 call to CORE::padav 
# spent 0s making 2 calls to CORE::pushmark, avg 0s/call


6	1	15.6ms			my $x = "x" x 4000000;
7	1	0s	2	0s	my $time1 = time;
# spent 0s making 1 call to CORE::pushmark 
# spent 0s making 1 call to Time::HiRes::time
8	1	56.5s	5	54.4s	my @a = split //, $x;
# spent 51.6s making 1 call to CORE::split 
# spent 2.78s making 1 call to CORE::aassign 
# spent 0s making 1 call to CORE::padav 
# spent 0s making 2 calls to CORE::pushmark, avg 0s/call
9	1	0s	2	0s	my $time2 = time;
# spent 0s making 1 call to CORE::pushmark 
# spent 0s making 1 call to Time::HiRes::time
10	1	2.16s	4	2.16s	@a = ();
# spent 2.16s making 1 call to CORE::aassign 
# spent 0s making 1 call to CORE::padav 
# spent 0s making 2 calls to CORE::pushmark, avg 0s/call

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=9319

Thread Previous | 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