mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2010
Posts: 5
N
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
N
Joined: Aug 2010
Posts: 5
Hi
Is there a way to load a hash table from a ~35mb text file (containing over 2000000 lines with single words)? When I try to do this, mIRC seems to hang up, eating more and more of RAM and 99% CPU.
Another thing is: why is it impossible to create a hash table with over 10000 slots?

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
10000 is just a soft limit, the same way mIRC limits lines of text to 4096 bytes. There's no technical reason besides the fact that making an assumption about an upper-bound allows you to optimize a few things.

Loading a 35mb text file is going to take time. It's not going to be instant, and it should "eat RAM" (specifically at *least* 70mb ram, if not much more). It could easily take anywhere from 10 seconds to a minute or so to load 35mb from disk into memory, since you're performing 4 million hash operations on that data as well. Why is this surprising you?

You shouldn't try to load large files into memory all at once, you should create a better way to query it either from disk using an in-memory cache or offload all that work to a DB system (SQL, BDB, etc.).


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Link Copied to Clipboard