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

Re: Memory efficient way to deal with really large arrays?

by eyepopslikeamosquito (Archbishop)
on Dec 13, 2020 at 05:18 UTC ( [id://11125094]=note: print w/replies, xml ) Need Help??


in reply to Memory efficient way to deal with really large arrays?

I have input which is 500M pairs of 32bit integers, which don't occur more than 256 times each. I want to load them into memory, and also have an array of how many times each int is in a pair.

From Fastest way to lookup a point in a set (a question I asked three years ago):

I have a large set of points. Each point has an x and y coordinate. The range of values for x and y are -2,147,483,648 to 2,147,483,647 (i.e. 32-bit signed int). I am running a 64-bit version of Perl; this code is not required to run in a 32-bit environment. I need to insert the set of points into a Perl data structure ... then perform many lookups to tell if a given point is in the set or not. I want the lookup to be as fast as possible.
These two problem statements sound similar enough that examining replies to my original Fastest way to lookup a point in a set question might prove worthwhile.

Word of warning though, as indicated at Re^2: More Betterer Game of Life, while applying a long series of micro-optimizations to the code improved my running time from 1635 secs to 450 secs (3.6 times faster), stepping away from the code to find a better algorithm reduced my running time from 450 secs to 17 secs (26 times faster).

Refs:

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-03-29 08:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found