develooper Front page | perl.perl5.porters | Postings from August 2010

Re: Patch to make string-append on win32 100 times faster

Thread Previous | Thread Next
Ben Morrow
August 16, 2010 16:25
Re: Patch to make string-append on win32 100 times faster
Message ID:
Quoth (Wolfram Humann):
> But I also tried to follow up on Peter J. Holzer's remarks in 
> <>. 
> He used strace for a closer look at what GNU malloc does and found that 
> it leaves free space after allocated memory so that it can often realloc 
> without moving  memory.

Does glibc have a malloc_size() function (or equivalent), and does perl
use it? You can check with perl -V:'d_malloc.*_size'. If there is such a
function but perl isn't finding it it may be worth fixing that. 

FreeBSD appears to have an equivalent function called malloc_usable_size, 
defined in <malloc_np.h>, which perl doesn't know about. When I get a
chance I'll try hacking it in to see if it makes a difference (I don't
think I've a hope of doing a proper Configure patch for it :().

> This free space (as far as I understand form 
> watching private memory usage reported by Linux::Smaps) is not 
> considered part of perl's memory ntil actually used.

This is usual. Mapped memory that hasn't been touched yet isn't actually
allocated anywhere by the kernel. (Linux is more aggressive about
allowing over-allocation from userland than some other OSen.)


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About