[issue21233] Add *Calloc functions to CPython memory allocation API

Antoine Pitrou report at bugs.python.org
Mon Apr 28 01:35:24 CEST 2014


Antoine Pitrou added the comment:

> Ok, now the real use case where it becomes faster: I implemented the
> same optimization for bytearray.

The real use case I envision is with huge powers of two. If I write:

  x = 2 ** 1000000

then all of x's bytes except the highest one will be zeros. If we map those to /dev/zero, it will be a massive saving for programs using huge powers of two.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21233>
_______________________________________


More information about the Python-bugs-list mailing list