Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
more useful options
 
PerlMonks  

Re^5: Working with fixed length files

by Anonymous Monk
on Apr 28, 2011 at 09:27 UTC ( #901759=note: print w/ replies, xml ) Need Help??


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

perl version?

With your program I get 'x' outside of string in unpack because of the x2, after removing those, I get

Rate buk ike buk 19.6/s -- -43% ike 34.1/s 74% -- $ perl -e "die $^V" v5.12.2
On 5.008009 I get
Rate buk ike buk 22.7/s -- -35% ike 35.1/s 54% --
Rate buk ike buk 24.9/s -- -47% ike 47.1/s 89% -- $ ..\perl.exe -e " die $^V" v5.14.0
This is typical win32 mingw/activestate build

update: Well you didn't copy buk's code exactly, you omitted

local $/ = \(2 * 122);

which appears critical
5.008009 Rate ike buk ike 35.5/s -- -57% buk 83.1/s 134% -- v5.12.2 Rate ike buk ike 33.6/s -- -55% buk 74.4/s 121% -- v5.14.0 Rate ike buk ike 46.3/s -- -48% buk 88.2/s 91% --


Comment on Re^5: Working with fixed length files
Select or Download Code
Re^6: Working with fixed length files
by Tux (Monsignor) on Apr 28, 2011 at 09:41 UTC

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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://901759]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2014-04-18 05:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (461 votes), past polls