Note that there are some explanatory texts on larger screens.

plurals
  1. POProfiling Perl with DProf, with long Total elapsed times
    text
    copied!<p>I just profiled my code with DProf:</p> <pre><code>Total Elapsed Time = 9.969922 Seconds User+System Time = 0.049922 Seconds Exclusive Times %Time ExclSec CumulS #Calls sec/call Csec/c Name 40.0 0.020 0.020 2 0.0100 0.0100 main::difference 40.0 0.020 0.020 3 0.0067 0.0066 main::BEGIN 0.00 - -0.000 1 - - DynaLoader::dl_install_xsub 0.00 - -0.000 1 - - Data::Dumper::bootstrap 0.00 - -0.000 1 - - strict::import 0.00 - -0.000 1 - - warnings::BEGIN 0.00 - -0.000 1 - - warnings::import 0.00 - -0.000 1 - - bytes::import 0.00 - -0.000 1 - - strict::bits 0.00 - -0.000 1 - - DynaLoader::dl_load_file 0.00 - -0.000 1 - - DynaLoader::dl_undef_symbols 0.00 - -0.000 1 - - DynaLoader::dl_find_symbol 0.00 - -0.000 1 - - overload::BEGIN 0.00 - -0.000 2 - - warnings::register::mkMask 0.00 - -0.000 2 - - Exporter::import </code></pre> <p>So my <code>difference</code> subroutine takes around 40% of the time, and <code>BEGIN</code> takes up the other 40%. I'm not so sure what is going on for the other 9.8 seconds. Could anyone explain to me what Perl is doing for the rest of the time?</p> <p>Basically, my code takes in two arrays, performs a set difference, and writes to a file. The files are not too large (23,028 characters). This is my <code>difference</code> subroutine, if you are curious:</p> <pre><code>sub difference { my @array1 = @{$_[0]}; my @array2 = @{$_[1]}; my %in_array1 = map {$_ =&gt; 1} @array1; my @diff = grep {not $in_array1{$_}} @array2; return @diff; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload