{"id":46,"date":"2006-04-04T16:13:48","date_gmt":"2006-04-04T21:13:48","guid":{"rendered":"http:\/\/raffy.ch\/blog\/?p=46"},"modified":"2006-04-04T16:17:14","modified_gmt":"2006-04-04T21:17:14","slug":"perl-performance-optimization","status":"publish","type":"post","link":"https:\/\/raffy.ch\/blog\/2006\/04\/04\/perl-performance-optimization\/","title":{"rendered":"Perl Performance Optimization"},"content":{"rendered":"<p>I was working on <a href=\"http:\/\/afterglow.sourceforge.net\">AfterGlow<\/a> the other night and I realized that adding feature after feature starts to slow down the thing quite a bit (you need to be a genious to figure that one out!). So that prompted me to look for Perl performance analyzers and indeed I found something that&#8217;s pretty useful.<\/p>\n<p>Run your perl script with: <code>perl -d:DProf<\/code> and then run <code>dprofpp<\/code>. This will show you how much time was spent in each of the subroutines. It helped me pinpoint that most of the time was spent in the getColor() call. The logical solution was to introduce a cache for the colors and guess what &#8211; AfterGlow 1.5.1 will be faster \ud83d\ude09<\/p>\n<p>This is a sample output of dprofpp:<\/p>\n<p><code>Total Elapsed Time = 11.69959 Seconds<br \/>\n  User+System Time = 8.969595 Seconds<br \/>\nExclusive Times<br \/>\n%Time ExclSec CumulS #Calls sec\/call Csec\/c  Name<br \/>\n 81.5   7.310  9.900 120000   0.0001 0.0001  main::getColor<br \/>\n 29.1   2.615  2.615 116993   0.0000 0.0000  main::subnet<br \/>\n 0.89   0.080  0.080  20000   0.0000 0.0000  main::getEventName<br \/>\n 0.22   0.020  0.020  20000   0.0000 0.0000  main::getSourceName<br \/>\n 0.22   0.020  0.020  20000   0.0000 0.0000  main::getTargetName<br \/>\n 0.11   0.010  0.010      1   0.0100 0.0100  main::BEGIN<br \/>\n 0.00       - -0.000      1        -      -  Exporter::import<br \/>\n 0.00       - -0.000      1        -      -  Getopt::Std::getopts<br \/>\n 0.00       - -0.000      1        -      -  main::propertyfile<br \/>\n 0.00       - -0.000      1        -      -  main::init<br \/>\n    -       - -0.025 116993        -      -  main::field<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was working on AfterGlow the other night and I realized that adding feature after feature starts to slow down the thing quite a bit (you need to be a genious to figure that one out!). So that prompted me to look for Perl performance analyzers and indeed I found something that&#8217;s pretty useful. Run [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-46","post","type-post","status-publish","format-standard","hentry","category-programming"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/posts\/46","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/comments?post=46"}],"version-history":[{"count":0,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/posts\/46\/revisions"}],"wp:attachment":[{"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/media?parent=46"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/categories?post=46"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/tags?post=46"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}