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

Note that if you keep local $/ = \122; in ike1, it has a *huge* influence on performance,

That's may be because as you haven't used binmode, IO layers are still in force and are checking for the default input delimiter (newlines) even though they are not being used. By setting $/ = \nnn, it stops the input buffer being scanned as it is loaded. (Or something like that. :)

I'd expect to see similar changes with $/ = \nnn in the other routines to.

I really like your idea of binding unpack templates to an array of aliases to partitions of a buffer. Effectively 'compiling' the template much as /o (used) to compile regexes.


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^8: Working with fixed length files
by Tux (Canon) on Apr 28, 2011 at 11:52 UTC

    In a dedicated benchmark to test this, binmode doesn't change anything at all:

    with a binmode call: Rate with_rs without with_rs 254857/s -- -34% without 384458/s 51% -- without a binmode call: Rate with_rs without with_rs 260564/s -- -31% without 375127/s 44% --

    I've just posted the question to the perl5 porters.


    Enjoy, Have FUN! H.Merijn