develooper Front page | perl.perl5.porters | Postings from February 2018

[perl #8910] Subroutine doesn't create elements.

Thread Next
From:
Sergey Aleynikov via RT
Date:
February 20, 2018 22:23
Subject:
[perl #8910] Subroutine doesn't create elements.
Message ID:
rt-4.0.24-1723-1519165391-1825.8910-15-0@perl.org
Here's some comparison between a97021b9d2 (representing point right before this change) and 8c11620dca (representing blead):


% perf stat -r 5 -e instructions,branches,branch-misses,cache-misses ./miniperl_a97021b9d2 -e 'sub foo{} $a[5] = 1; foo(@a) for (1..100_000_000)'

 Performance counter stats for './miniperl_a97021b9d2 -e sub foo{} $a[5] = 1; foo(@a) for (1..100_000_000)' (5 runs):

    68,408,669,959      instructions                                                  ( +-  0.00% )
    13,001,633,581      branches                                                      ( +-  0.00% )
            49,824      branch-misses             #    0.00% of all branches          ( +-  2.59% )
            17,808      cache-misses                                                  ( +- 35.84% )

       7.886012337 seconds time elapsed                                          ( +-  0.45% )

% perf stat -r 5 -e instructions,branches,branch-misses,cache-misses ./miniperl_8c11620dca -e 'sub foo{} $a[5] = 1; foo(@a) for (1..100_000_000)'

 Performance counter stats for './miniperl_8c11620dca -e sub foo{} $a[5] = 1; foo(@a) for (1..100_000_000)' (5 runs):

    68,208,661,954      instructions                                                  ( +-  0.00% )
    13,601,633,162      branches                                                      ( +-  0.00% )
            50,091      branch-misses             #    0.00% of all branches          ( +-  1.05% )
            23,055      cache-misses                                                  ( +- 25.61% )

       7.753697959 seconds time elapsed                                          ( +-  0.43% )

Calling subs with empty slots takes now ~4% more branches.




% perf stat -r 5 -e instructions,branches,branch-misses,cache-misses ./miniperl_a97021b9d2 -e 'sub foo{} @a=(1)x5; foo(@a) for (1..100_000_000)'

 Performance counter stats for './miniperl_a97021b9d2 -e sub foo{} @a=(1)x5; foo(@a) for (1..100_000_000)' (5 runs):

    66,508,170,242      instructions                                                  ( +-  0.00% )
    12,601,545,986      branches                                                      ( +-  0.00% )
            55,329      branch-misses             #    0.00% of all branches          ( +-  2.02% )
            20,607      cache-misses                                                  ( +- 31.11% )

       7.426998822 seconds time elapsed                                          ( +-  0.09% )

% perf stat -r 5 -e instructions,branches,branch-misses,cache-misses ./miniperl_8c11620dca -e 'sub foo{} @a=(1)x5; foo(@a) for (1..100_000_000)'

 Performance counter stats for './miniperl_8c11620dca -e sub foo{} @a=(1)x5; foo(@a) for (1..100_000_000)' (5 runs):

    66,308,249,789      instructions                                                  ( +-  0.00% )
    13,101,560,547      branches                                                      ( +-  0.00% )
            69,581      branch-misses             #    0.00% of all branches          ( +-  3.59% )
            27,929      cache-misses                                                  ( +- 17.41% )

       7.480210740 seconds time elapsed                                          ( +-  0.26% )


Calling subs with dense array is, again, taking 4% more branches.

Blead is chosen here to demonstrate that nothing fundamentally changed after recent patches from Father Chrysostomos, the main hit was done by 6661956a23 (though instructions improved a bit, but I didn't pinpoint that to specific commit/change):

% perf stat -r 5 -e instructions,branches,branch-misses,cache-misses ./miniperl_6661956a23 -e 'sub foo{} $a[5] = 1; foo(@a) for (1..100_000_000)'

 Performance counter stats for './miniperl_6661956a23 -e sub foo{} $a[5] = 1; foo(@a) for (1..100_000_000)' (5 runs):

    68,708,344,437      instructions                                                  ( +-  0.00% )
    13,601,578,019      branches                                                      ( +-  0.00% )
            56,758      branch-misses             #    0.00% of all branches          ( +-  8.07% )
            17,868      cache-misses                                                  ( +- 35.83% )

       7.620128855 seconds time elapsed                                          ( +-  0.52% )

---
via perlbug:  queue: perl5 status: pending release
https://rt.perl.org/Ticket/Display.html?id=8910

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About