Thank you for all the answers! My problem is solved even better than I
expected!
@Peter: Yes, the garbage collector was causing the slowdown. Switching
it off sped the program up; each iteration was taking the same amount
of time. I ran collection manually every 10 iterations to control
memory usa
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Let me comment on what happens in you're code:
> The place where you create new objects is
> keys = [str(x) for x in range(20)] # here you create 20
> strings which will be reused ( by reference )
>and
> my_dict[key] = (key, key) # h
On May 31, 8:30 pm, Maciej Bliziński <[EMAIL PROTECTED]>
wrote:
> Hi Pythonistas!
>
> I've got a question about storing tuples in a dictionary. First, a
> small test case which creates a list of dictionaries:
>
> import time
>
> list_of_dicts = []
> keys = [str(x) for x in range(20)]
> prev_clk
Maciej Blizi?ski wrote:
> Hi Pythonistas!
>
> I've got a question about storing tuples in a dictionary. First, a
> small test case which creates a list of dictionaries:
>
> import time
>
> list_of_dicts = []
> keys = [str(x) for x in range(20)]
> prev_clk = time.clock()
> for i in range(20)
Hi Pythonistas!
I've got a question about storing tuples in a dictionary. First, a
small test case which creates a list of dictionaries:
import time
list_of_dicts = []
keys = [str(x) for x in range(20)]
prev_clk = time.clock()
for i in range(20):
my_dict = {}
for key in keys: