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
From:
Ben Morrow
Date:
August 16, 2010 16:25
Subject:
Re: Patch to make string-append on win32 100 times faster
Message ID:
20100816232505.GA58954@osiris.mauzo.dyndns.org
Quoth w.c.humann@arcor.de (Wolfram Humann):
> 
> But I also tried to follow up on Peter J. Holzer's remarks in 
> <http://groups.google.com/group/comp.lang.perl.misc/msg/8747b64794aec27b>. 
> 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.)

Ben


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About