STINNER Victor added the comment:

> ... and it turns out that munmapping is not always that smart thing to do: 
> http://stackoverflow.com/questions/36548518/variable-assignment-faster-than-one-liner

py -3 -m timeit "tuple(range(2000)) == tuple(range(2000))"
10000 loops, best of 3: 97.7 usec per loop
py -3 -m timeit "a = tuple(range(2000));  b = tuple(range(2000)); a==b"
10000 loops, best of 3: 70.7 usec per loop

Hum, it looks like this specific benchmark spends a lot of time to allocate one 
arena and then release it.

Maybe we should keep one "free" arena to avoid the slow mmap/munmap. But it 
means that we keep 256 KB of unused memory.

Maybe we need an heuristic to release the free arena after N calls to object 
allocator functions which don't need this free arena.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26601>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to