Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: A way to pack string into another light weight structure

by wrog (Friar)
on Dec 29, 2011 at 10:12 UTC ( [id://945473]=note: print w/replies, xml ) Need Help??


in reply to A way to pack string into another light weight structure

pack 'L',$number but this will fail if you have any numbers bigger than 4294967295 (2**32-1), in which case, barring any knowledge of large, unused ranges, 5 bytes is the best you're going to do, and you may as well be doing pack 'H10',$number

However, instead of trying to compress things, you might be better off using an off-line algorithm that doesn't require everything being in memory at once, e.g.,

  1. open 16 new files for writing
  2. go through the array sequentially, copy each record to a randomly chosen file of the 16.
  3. close all of the files
  4. randomize each file (~7M) separately
  5. concatenate

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-03-28 19:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found