Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Perl memory limit - Windows64 strawberry perl

by sundialsvc4 (Abbot)
on Mar 18, 2021 at 19:45 UTC ( #11129918=note: print w/replies, xml ) Need Help??


in reply to Perl memory limit - Windows64 strawberry perl

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on Re: Perl memory limit - Windows64 strawberry perl

Replies are listed 'Best First'.
Re^2: Perl memory limit - Windows64 strawberry perl
by sectokia (Beadle) on Mar 24, 2021 at 10:44 UTC

    In this specific example my use case simplifies to this:

    -File 'A' with unique ID's

    -File 'B' is a list of possibly repeating ID's.

    The output needs to be a count of how many times each ID in file 'A' occurs in file 'B'.

    So to do this I just create a hash with keys being all the ID's from 'A', and value being a count of how many times it is seen.

    File B is then streamed through to update the counters of the hash.

    Now this works for me because the memory size, and my number of items, just happens to be a reasonable size for computers these days, falling somewhere between 4GB and 16GB as peak memory used.

    I would be very interested in ideas people have for how to achieve this on a local PC without using much RAM, while also not just using disk in place of RAM. One way is to obviously load a subset of keys from A, then stream the file B to update counts for just those keys, and save the results. Then load the next lot of keys, and re-stream the entire file B, repeat until done. This is probably what I would do if I ran out of RAM. But while I have the RAM, I want to use it.

    If both files were sorted, I could stream both at the same time, as I would know which ID's I pass. But in my case File 'A's sequence of ID's is important. So if I sorted A, I would have to reconstruct its order, and I don't see how sorting would be done without using just as much RAM.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2021-05-07 10:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (91 votes). Check out past polls.

    Notices?