in reply to Re^5: Working with fixed length files
in thread Working with fixed length files

I re-read BrowserUk's post, and I still don't see that line. And yes, I copied it exactly.

The x2 error you see is because you didn't add the \r's to the DATA section as I wrote in the introduction line. They get lost when posting code on PM.

Adding that line to his code is unfair, as that will skip half of the data. Fair would be to use \122, but that doesn't change much:

=== base/perl5.8.9 5.008009 i686-linux-64int Rate buk ike buk 66.7/s -- -39% ike 109/s 63% -- === base/tperl5.8.9 5.008009 i686-linux-thread-multi-64int-ld Rate buk ike buk 61.1/s -- -37% ike 96.7/s 58% -- === base/perl5.10.1 5.010001 i686-linux-64int Rate buk ike buk 63.3/s -- -39% ike 104/s 65% -- === base/tperl5.10.1 5.010001 i686-linux-thread-multi-64int-ld Rate buk ike buk 56.1/s -- -37% ike 88.8/s 58% -- === base/perl5.12.2 5.012002 i686-linux-64int Rate buk ike buk 62.5/s -- -41% ike 105/s 69% -- === base/tperl5.12.2 5.012002 i686-linux-thread-multi-64int-ld Rate buk ike buk 54.5/s -- -38% ike 88.4/s 62% -- === base/perl5.14.0 5.014000 i686-linux-64int Rate buk ike buk 60.6/s -- -48% ike 116/s 92% -- === base/tperl5.14.0 5.014000 i686-linux-thread-multi-64int-ld Rate buk ike buk 53.8/s -- -49% ike 105/s 96% --

Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^7: Working with fixed length files
by Anonymous Monk on Apr 28, 2011 at 09:50 UTC
    I re-read BrowserUk's post, and I still don't see that line. And yes, I copied it exactly.

    Look at his benchmark code, you know, the node with the numbers :)

    Adding that line to his code is unfair, as that will skip half of the data. Fair would be to use \122, but that doesn't change much:

    Ok, right, he had \123, the difference is smaller

    5.008009 Rate ike buk ike 34.7/s -- -17% buk 41.6/s 20% -- v5.12.2 Rate ike buk ike 32.9/s -- -16% buk 39.4/s 20% -- v5.14.0 Rate buk ike buk 45.5/s -- -1% ike 45.9/s 1% --
    Maybe i'll run buk's benchmark now

      Right. I can explain that!

      ikegami reads in two lines in one go and unpacks both lines with one single unpack, which is why he uses \(2 * 122). That makes his test code almost twice as fast as the code that BrowserUk translated it to, which reads the two lines in two separate read/unpack sequences.

      The difference between \122 and \123 is most likely to blame on Windows line endings. That is why ikegami used x2's and BrowserUk uses x3's.

      Interesting thread though :)


      Enjoy, Have FUN! H.Merijn
Re^7: Working with fixed length files
by Anonymous Monk on Apr 28, 2011 at 09:57 UTC
    The x2 error you see is because you didn't add the \r's to the DATA section as I wrote in the introduction line.

    Right, something about my keyboard lacking an \r key :)

    My rule of thumb, if data contains special characters, Dumper-it