speeding up dictionary creation

Darrell Gallion darrell at dorb.com
Fri Aug 18 01:04:20 EDT 2000


Don't know if this is faster than cPickle or not.
Write your data to a dictionary in a .py file which becomes compiled as a
.pyc
Importing the pyc is pretty fast.

--Darrell


----- Original Message -----
From: "Peter Schneider-Kamp" <nowonder at nowonder.de>
To: "Bob van der Poel" <bvdpoel at uniserve.com>
>
> I do not think the majority is spent in creating new entries. See the
> statistics below - creating the dict from the list is fast.
> (Especially look at the second statistic ...)
>
> [first statistic on 17576 dict entries - worst of three runs]
> Creating list of 17576 keys ...
>          37262 function calls (30 primitive calls) in 2.680 CPU seconds
>
> Creating dictionary from list of keys ...
>          2 function calls in 0.080 CPU seconds
>
> pickle.dump of dictionary ...
>          123041 function calls (87889 primitive calls) in 11.960 CPU
> seconds
>
.....





More information about the Python-list mailing list