http://www.perlmonks.org?node_id=1016066


in reply to Re: Speed up hash initialization loop
in thread Speed up hash initialization loop

This sounds like what I need to do but I don't understand where to deref. Should this be within the subroutine? If it is outside of the subroutine, I think I'm already doing this, my %profEvntVar is defined above, and in the end I need it to contain all of the info about each profile in @profiles

Sorry if I'm missing something

  • Comment on Re^2: Speed up hash initialization loop

Replies are listed 'Best First'.
Re^3: Speed up hash initialization loop
by Anonymous Monk on Jan 31, 2013 at 20:44 UTC
    if(exists $profEvntVar->{$customProf}){next;} my $cprof = $profEvntVar->{$customProf} = {}; my ($evnt_nums_ref,$var_names_ref,$variables_ref,$last_evn +t_name) = getvars($customProf); $cprof->{events} = $evnt_nums_ref; #Link profiles with th +eir respective events $cprof->{times} = $evnt_times_ref; #Link profiles with th +eir respective events # etc

    FWIW, I don't think there'll be much gain (it should be in the order of microseconds), but since they're in a loop it might add up. This is not really an optimisation technique, but a code cleanup one.

    (Do change the naming of $cprof if you can think of a better name.)