Skip to content

Loading…

poor performance under profiling [rt.cpan.org #67858] #6

Open
dagolden opened this Issue · 0 comments

1 participant

@dagolden

https://rt.cpan.org/Ticket/Display.html?id=67858

I've been using Capture::Tiny lately to great effect, but recently came 
across a problem in conjunction with Devel::NYTProf. Perhaps you've 
already encountered this, but when run under profiling Capture::Tiny 
spends a great deal of time in C<_files_exist()>.

A simple demonstration would be:

> perl -d:NYTProf -MCapture::Tiny=tee_merged -le 'tee_merged { print 
"hi" } for 1 .. 100' > /dev/null
> nytprofcsv Generating CSV report...
Reading nytprof.out
Processing nytprof.out data
Writing sub reports to nytprof directory
 100% ...
Writing block reports to nytprof directory
 100% ...
Writing line reports to nytprof directory
 100% ...
> grep 'sub _files_exist' nytprof/Capture-Tiny-pm-2-sub.csv 
2.537151,196944,0.000013,sub _files_exist { -f $_ || return 0 for @_; 
return 1 }

That grep result shows that C<_files_exist()> was called almost 200,000 
times and took about 2.5 seconds. This adds noise to the profile output, 
and makes certain profiling tasks take an enormous amount of time.

When run without NYTProf, performance is fine, so it seems to be based 
on interference. I'm not sure if you can alter this behavior, but wanted 
to bring it to your attention.

Thanks for the module!

 - danboo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.