Skip Menu |

This queue is for tickets about the Graph CPAN distribution.

Report information
The Basics
Id: 11465
Status: resolved
Priority: 0/
Queue: Graph

People
Owner: Nobody in particular
Requestors: natg [...] shore.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.55
Fixed in: (no value)



Subject: Performance problem: source_vertices in compat02 mode
Greetings Jarkko I realize you may not want to waste time fixing compat02 mode problems, but I'm reporting this anyway for form sake. The problem came to my attention via the BioPerl mailing list. The source_vertices method runs quite slowly on graphs created in compat02 mode: 1000x (!!) slower on the real graph of interestto the guy who reported the problem in BioPerl (a DAG with 1396 nodes and 1755 edges). The timings for this graph on my test program (below) are v05: 74.061ms v02: 89.737s Here's the test program ---------- use strict; use Benchmark::Timer; use Graph::Directed; my $T; # global timer my($nodes,$edges)=@ARGV; defined $nodes or $nodes=10; defined $edges or $edges=int(1.5*$nodes); my $g05=new Graph::Directed(); my $g02=new Graph::Directed(compat02=>1); # make random DAGs for (my $new=1; $new<$nodes; $new++) { my $old=int rand $new; # grab a random node < $new $g05->add_edge($old,$new); $g02->add_edge($old,$new); } timer("\$g05->source_vertices: nodes=$nodes, edges=$edges"); my @roots=$g05->source_vertices; stop(); timer("\$g02->source_vertices: nodes=$nodes, edges=$edges"); my @roots=$g02->source_vertices; stop(); done(); sub timer { my($test)=@_; if ($T) { $T->stop; $T->report; $T->reset; } else { $T=new Benchmark::Timer; } $T->start($test); } sub stop {$T->stop; $T->report; $T=undef;} sub done {if ($T) {$T->stop; $T->report;} print STDERR "Done\n";} ---------- All the best, Nat
I think 0.56 behaves better.
Oh, rats, I thought it solved too soon. Reopened.
From: natg [...] shore.net
[guest - Thu Feb 10 16:06:51 2005]: I don't know if you noticed the bug in my test program: it doesn't create the number of edges claimed. It always creates $nodes-1 edges. This doesn't affect the gist of the reported problem. Sorry, Nat
I believe the Graph 0.57 sped up the compat02 case considerably. Whether that's a fix or not can be debated, but I'm marking this ticket as resolved.