Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Optimizing binary file parser (pack/unpack)

by Corion (Patriarch)
on Oct 03, 2017 at 08:12 UTC ( [id://1200589]=note: print w/replies, xml ) Need Help??


in reply to Optimizing binary file parser (pack/unpack)

Depending on whether you actually need to unpack each record or not, you can maybe hardcode the offsets to reject rows before actually unpacking them. index can quickly look at a position in a string without needing pack or unpack.

Depending on how you unpack things, it might be quicker to build one large unpack template instead of unpacking items in a loop.

  • Comment on Re: Optimizing binary file parser (pack/unpack)

Replies are listed 'Best First'.
Re^2: Optimizing binary file parser (pack/unpack)
by pwagyi (Monk) on Oct 03, 2017 at 08:16 UTC
    I've to unpack all fields of records. Yes I'm already grouping one large template as much as possible. But there are optional fields in record so that had to be handled as well.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-20 03:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found