seek in a file
Grant Edwards
grante at visi.com
Wed Mar 27 23:54:42 EST 2002
In article <a7u0p4$2bhv$1 at news.idiom.com>, Jim Dennis wrote:
> Of course I recognize that this might be a multi-user
> system (possibly with lots of POS terminals attached,
> and the bar code scanners attached to those). In that
> case consuming a meg or two of memory for the barcodes
> dictionary *for each process* might get expensive.
Build an index into it. Then mmap() it. You have O(1) access to
any line in the file, and only the pages that get used will
get pulled into RAM. As long as nobody writes to it, all
processes will share copies of the pages.
Let the OS worry about managing memory and disk buffers.
That's what it's there for.
--
Grant Edwards grante Yow! RELATIVES!!
at
visi.com
More information about the Python-list
mailing list