Customization
I have a set of unique integers with values ββfrom 1 to 50 million. New integers are added randomly, for example. numberset.add(random.randint(1, 50000000)) . I need to be able to quickly add new integers and quickly check if an integer is present.
Problem
After a while, the set gets too large for my low memory system and I experience MemoryError s.
Question
How can I achieve this using less memory? What is the fastest way to do this using a disk without reconfiguring the system, for example. swapfiles? Should I use a database file such as sqlite? Is there a library that will compress integers in memory?
source share