in reply to Re^2: using bits to print part of a string
in thread using bits to print part of a string

BTW: There is a problem with your substrwise test.

The first time through, $mask is undefined, so you set up @mask and set smask.

But on the second and subsequent times through, $mask is defined, so the non-state variable: @mask is left empty, so you don't do any actual work.

That probably explains the surprising apparent efficiency of substrwise in the figures McA posted.


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.

Replies are listed 'Best First'.
Re^4: using bits to print part of a string.(bug)
by choroba (Cardinal) on Mar 17, 2013 at 08:05 UTC
    Thanks for catching the problem.

    BTW, I had to change the condition in substrref to

    while $mask =~ /1+/g
    to get the same results as from the other methods.
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re^4: using bits to print part of a string.(bug)
by McA (Priest) on Mar 16, 2013 at 17:12 UTC

    Aaaarrggghh, and I just started to change every regex substitution in my code to a combination of index and substr to get cutting edge performance... ;-)

    McA

      I just started to change every regex substitution in my code to a combination of index and substr to get cutting edge performance... ;-)

      Now you'll have to change them all to bitwise ops :)


      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.