On 2011-11-28 Thorsten Glaser wrote:
> Stefan Westerfeld dixit:
> 
> >Just a thought: could performance be improved if xz requested the
> >memory via mmap(), like
> 
> No, because any self-respecting modern malloc(3) implementation
> uses mmap(2) internally, see omalloc for example. (That’s Otto
> Moerbeek’s last one, found e.g. in OpenBSD.)

The point was that with mmap you are guaranteed that the memory is
already zeroed (or will be zeroed when kernel does the physical
allocation). With malloc the contents of the memory is undefined.
There's also calloc, but with a quick and inaccurate test with glibc,
it doesn't seem faster than malloc+memset.

-- 
Lasse Collin  |  IRC: Larhzu @ IRCnet & Freenode

Reply via email to