in reply to Re: list of scalars vs arrays, speed?
in thread list of scalars vs arrays, speed?

If I add a couple of tests where, instead of messing with globals you use lexical variables (just stick a 'my' at the front of each sub), I get the following results from a cmpthese(-10,{...}) run. I've combined the two sizes of test, hopefully the table is self explanatory.
              Rate $ 1000 @ 1000 my $ 1000 my @ 1000 my @ 5    @ 5 my $ 5    $ 5
$ 1000      1192/s     --   -15%      -15%      -22%   -99%   -99%  -100%  -100%
@ 1000      1399/s    17%     --       -1%       -8%   -99%   -99%  -100%  -100%
my $ 1000   1408/s    18%     1%        --       -8%   -99%   -99%  -100%  -100%
my @ 1000   1528/s    28%     9%        8%        --   -99%   -99%  -100%  -100%
my @ 5    126214/s 10492%  8921%     8861%     8162%     --   -34%   -60%   -63%
@ 5       191633/s 15981% 13596%    13506%    12445%    52%     --   -40%   -44%
my $ 5    317943/s 26581% 22624%    22474%    20713%   152%    66%     --    -7%
$ 5       341012/s 28517% 24273%    24111%    22224%   170%    78%     7%     --
Hmm... I do like the way the 1000s are almost the reverse of the 5s. Life's too short to go generating a graph to find out where the crossover points are, but it's certainly odd...
  • Comment on Re: Re: list of scalars vs arrays, speed?