in reply to Re^3: Faster Hash Slices
in thread Faster Hash Slices

Maybe the verification of the reference type explains the difference?
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^5: Faster Hash Slices
by BrowserUk (Patriarch) on Nov 28, 2013 at 14:35 UTC

    The difference appears to be that a pad lookup requires a single opcode where dereferencing a hashref requires three opcodes:

    9 <;> nextstate(main 47 -e:1) v:%,{ ->a f <; +> nextstate(main 47 -e:1) v:%,{ ->g a <;> nextstate(main 47 -e:1) v:%,{ ->b g <; +> nextstate(main 47 -e:1) v:%,{ ->h m <2> leaveloop vK/2 ->n u <2 +> leaveloop vK/2 ->v f <{> enteriter(next->j last->m redo->g) lKS/8 ->k l + <{> enteriter(next->r last->u redo->m) lKS/8 ->s - <0> ex-pushmark s ->b - + <0> ex-pushmark s ->h - <1> ex-list lK ->e - + <1> ex-list lK ->k b <0> pushmark s ->c h + <0> pushmark s ->i c <$> const[IV 1] s ->d i + <$> const[IV 1] s ->j d <$> const[IV 10] s ->e j + <$> const[IV 10] s ->k e <#> gv[*_] s ->f k + <#> gv[*_] s ->l - <1> null vK/1 ->m - + <1> null vK/1 ->u l <|> and(other->g) vK/1 ->m t + <|> and(other->m) vK/1 ->u k <0> iter s ->l s + <0> iter s ->t - <@> lineseq vK ->- - + <@> lineseq vK ->- i <1> exists vK/1 ->j q + <1> exists vK/1 ->r - <1> ex-helem sK/2 ->i - + <1> ex-helem sK/2 ->q g <0> padhv[%h:46,47] sR ->h o + <1> rv2hv[t8] sKR/1 ->p n + <1> rv2sv sKM/DREFHV,1 ->o m + <#> gv[*r] s ->n - <1> ex-rv2sv sK/1 ->- - + <1> ex-rv2sv sK/1 ->- h <#> gvsv[*_] s ->i p + <#> gvsv[*_] s ->q j <0> unstack v ->k r + <0> unstack v ->s -e syntax OK -e synta +x OK

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      I made a mistake (used a global reference); the difference is one extra opcode, not two extra:

      9 <;> nextstate(main 47 -e:1) v:%,{ ->a f <;> ne +xtstate(main 48 -e:1) v:%,{ ->g a <;> nextstate(main 47 -e:1) v:%,{ ->b g <;> ne +xtstate(main 48 -e:1) v:%,{ ->h m <2> leaveloop vK/2 ->n t <2> le +aveloop vK/2 ->u f <{> enteriter(next->j last->m redo->g) lKS/8 ->k l <{> + enteriter(next->q last->t redo->m) lKS/8 ->r - <0> ex-pushmark s ->b - +<0> ex-pushmark s ->h - <1> ex-list lK ->e - +<1> ex-list lK ->k b <0> pushmark s ->c h + <0> pushmark s ->i c <$> const[IV 1] s ->d i + <$> const[IV 1] s ->j d <$> const[IV 10] s ->e j + <$> const[IV 10] s ->k e <#> gv[*_] s ->f k +<#> gv[*_] s ->l - <1> null vK/1 ->m - <1> + null vK/1 ->t l <|> and(other->g) vK/1 ->m s +<|> and(other->m) vK/1 ->t k <0> iter s ->l r + <0> iter s ->s - <@> lineseq vK ->- - + <@> lineseq vK ->- i <1> exists vK/1 ->j p + <1> exists vK/1 ->q - <1> ex-helem sK/2 ->i - + <1> ex-helem sK/2 ->p n + <1> rv2hv[t7] sKR/1 ->o g <0> padhv[%h:46,47] sR ->h m + <0> padsv[$r:47,48] sM/DREFHV ->n - <1> ex-rv2sv sK/1 ->- - + <1> ex-rv2sv sK/1 ->- h <#> gvsv[*_] s ->i o + <#> gvsv[*_] s ->p j <0> unstack v ->k q + <0> unstack v ->r -e syntax OK e syntax OK

      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.