develooper Front page | perl.perl5.porters | Postings from October 2014

Re: Single-item padrange?

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
October 17, 2014 14:05
Subject:
Re: Single-item padrange?
Message ID:
20141017140518.GF5204@iabyn.com
On Mon, Oct 13, 2014 at 07:33:23PM -0000, Father Chrysostomos wrote:
> Dave Mitchell wrote:
> > IIRC, I was thinking that it saves the overhead of a call to pp_pushmark;
> > but whether that compensates for the extra overhead in pp_padrange and
> > leave_scope(), I don't know (but suspect not). It probably needs
> > cachegrinding to find out.
> 
> i see.  I had forgotten that padrange takes the place of pushmark.

running cachegrind on this code:

    -e'for (1..10_000) { my ($x) = 1 }'

with padrange disabled:

    5  <0> pushmark s
    6  <0> padsv[$x:1,2] lPRM*/LVINTRO

and enabled

    5  <0> padrange[$x:1,2] l/LVINTRO,1

Gices the following two summaries. In short, padrange executes more
instructions, but has less data reads and writes; the overall effect on
the combined cache being marginally worse. So perhaps I should change it
for only two+ pad vars (or 1 pad var plus @_)?

without padrange

==5163== I   refs:      6,855,575
==5163== I1  misses:        4,618
==5163== LLi misses:        3,036
==5163== I1  miss rate:      0.06%
==5163== LLi miss rate:      0.04%
==5163== 
==5163== D   refs:      3,473,625  (2,302,903 rd   + 1,170,722 wr)
==5163== D1  misses:        9,361  (    6,025 rd   +     3,336 wr)
==5163== LLd misses:        5,643  (    2,760 rd   +     2,883 wr)
==5163== D1  miss rate:       0.2% (      0.2%     +       0.2%  )
==5163== LLd miss rate:       0.1% (      0.1%     +       0.2%  )
==5163== 
==5163== LL refs:          13,979  (   10,643 rd   +     3,336 wr)
==5163== LL misses:         8,679  (    5,796 rd   +     2,883 wr)
==5163== LL miss rate:        0.0% (      0.0%     +       0.2%  )

with padrange

==5167== I   refs:      7,026,281
==5167== I1  misses:        4,759
==5167== LLi misses:        3,080
==5167== I1  miss rate:      0.06%
==5167== LLi miss rate:      0.04%
==5167== 
==5167== D   refs:      3,443,608  (2,282,904 rd   + 1,160,704 wr)
==5167== D1  misses:        9,358  (    6,017 rd   +     3,341 wr)
==5167== LLd misses:        5,636  (    2,753 rd   +     2,883 wr)
==5167== D1  miss rate:       0.2% (      0.2%     +       0.2%  )
==5167== LLd miss rate:       0.1% (      0.1%     +       0.2%  )
==5167== 
==5167== LL refs:          14,117  (   10,776 rd   +     3,341 wr)
==5167== LL misses:         8,716  (    5,833 rd   +     2,883 wr)
==5167== LL miss rate:        0.0% (      0.0%     +       0.2%  )



-- 
Technology is dominated by two types of people: those who understand what
they do not manage, and those who manage what they do not understand. 

Thread Previous | 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