develooper Front page | perl.perl6.internals | Postings from October 2002

Re: Execute in place?

Thread Previous | Thread Next
From:
Dan Sugalski
Date:
October 25, 2002 12:59
Subject:
Re: Execute in place?
Message ID:
a05111b03b9df52a9628f@[63.120.19.221]
At 9:15 PM +1000 10/25/02, Rhys Weatherley wrote:
>I was just having a look at the packfile format code, and I
>have a suggestion on load-time performance of the code segment.
>
>Currently, you read the file, parse out the various sections,
>copy them elsewhere in memory, and byte-swap as necessary.
>The overhead of doing this could be quite significant on large
>applications/modules.
>
>A "trick" that I've found very useful in the past is to design
>the bytecode format so that it can be mmap'ed into a block of
>memory, and then executed almost immediately with the minimum
>number of fixups.  Rather than copying the instructions, you
>execute them directly out of the mmap'ed region.

Gah. This was how things were originally done, and what was supposed 
to be followed through on--if the segment on disk matched the host 
size/endianness, it's supposed to be just mmapped in. The constants 
section may need fixup (string and PMC constants, certainly) but the 
code itself is supposed to be shared. This is good for both speed 
reasons (as you noted) and for process size reasons, since we're 
definitely facing the potential for a half-zillion Apache mod_parrot 
processes mapping in the same bytecode to execute server-side 
programs.

If this has been broken, then we need to fix it, as it's a bug.
-- 
                                         Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                       teddy bears get drunk

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