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

[Omaha.pm] Wow. The New York Times profiler.



Title: Wow. The New York Times profiler.
Wow. The New York Times profiler is way too cool and insanely easy to use.

Question:  I'm just loading a little Moose object and printing it. Why is it taking over a second??

Answer:    Use the New York Times profiler:

$ perl -d:NYTProf j.pl
[123] Jay Hannah
$ nytprof nytprof.out

Result:

   http://jay.mammoth.org/tmp/nytprof/

Can you find the problem?  -grin-

Hint: In "Employee::string" at the top, click "string". There's my source code. See the problem?

Cheers,

j



(
   Note that you currently need the Google Code SVN version to see the code inside Moose objects. CPAN version is not yet sufficient.
   http://code.google.com/p/perl-devel-nytprof/source/checkout
)


The source code:

$ cat j.pl
#!/usr/bin/perl

use Employee;

my $e = Employee->new();
$e->first_name("Jay");
$e->last_name("Hannah");
$e->employee_id(123);

print $e->string, "\n";


Takes over a second to run:

$ time perl j.pl
[123] Jay Hannah

real    0m1.256s
user    0m0.233s
sys     0m0.021s