473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Sanity check on use of dictionaries

I am manipulating lots of log files (about 500,000 files and about 30Gb
in total) to get them into a little SQL db. Part of this process is
"normalisation" and creating tables of common data. I am creating
dictionaries for these in a simple {value,key} form.

In terms of memory and performance what are the reasonable limits for a
dictionary with a key and a 16 character string? eg; if I read in one
of my tables from disk into a dictionary, what sizing is comfortable?
100,000 entries? 1,000,000 entries? Lookup times and memory
requirements are my main worries.

(Running Python 2.3.4 on RH Ent, dual-Xeon with 2GB memory)

Nov 2 '06 #1
1 1464
do******@gmail.com wrote:
I am manipulating lots of log files (about 500,000 files and about 30Gb
in total) to get them into a little SQL db. Part of this process is
"normalisation" and creating tables of common data. I am creating
dictionaries for these in a simple {value,key} form.

In terms of memory and performance what are the reasonable limits for a
dictionary with a key and a 16 character string? eg; if I read in one
of my tables from disk into a dictionary, what sizing is comfortable?
100,000 entries? 1,000,000 entries? Lookup times and memory
requirements are my main worries.
you don't specify what a "key" is, but the following piece of code took
less than a minute to write, ran in roughly two seconds on my machine,
and results in a CPython process that uses about 80 megabytes of memory.
>>d = {}
for i in range(1000000):
.... k = str(i).zfill(16)
.... d[k] = k
....
>>k
'0000000000999999'

since dictionaries use hash tables, the lookup time is usually
independent of the dictionary size. also see:

http://www.effbot.org/pyfaq/how-are-...mplemented.htm

</F>

Nov 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Frohnhofer, James | last post by:
My initial problem was to initialize a bunch of dictionaries at the start of a function. I did not want to do def fn(): a = {} b = {} c = {} . . . z = {}
3
by: Shivram U | last post by:
Hi, I want to store dictionaries on disk. I had a look at a few modules like bsddb, shelve etc. However would it be possible for me to do the following hash = where the key is an int and not...
9
by: Fred Ma | last post by:
Hello, I posted previously under the thread: How to break this up into streambuf/ostream I've asked our library to get "C++ IOStreams and Locales..." by A. Langer et al. Meantime, I've...
210
by: Christoph Zwerschke | last post by:
This is probably a FAQ, but I dare to ask it nevertheless since I haven't found a satisfying answer yet: Why isn't there an "ordered dictionary" class at least in the standard list? Time and again...
2
by: Jonathan Pryor | last post by:
I'm in need of a sanity check: is the following code valid C++? namespace foo { class NamespaceClass { }; } using namespace foo; class Bug_GlobalFriendDeclaresNamespaceClass {
6
by: Dan Henry | last post by:
I need a sanity check. The following is an exchange on comp.arch.embedded with CBFalconer in a rather long MISRA related thread. Since my little section of that thread and area of interest was...
0
by: cypher_key | last post by:
I'm C# and would like to get a sanity check from the group to ensure that I'm going down the right road. The first form in my mini-application is a search screen. I have an image of it here:...
3
by: stevewilliams2004 | last post by:
I am attempting to create a singleton, and was wondering if someone could give me a sanity check on the design - does it accomplish my constraints, and/or am I over complicating things. My design...
14
by: cnb | last post by:
Are dictionaries the same as hashtables?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.