Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Perl 6 and byte code

42 views
Skip to first unread message

Stéphane Payrard

unread,
Oct 27, 2004, 7:39:44 AM10/27/04
to Perl 6 Internals
On Wed, Oct 27, 2004 at 12:00:33PM +0100, Peter Hickman wrote:
> Presently Python compiles it's py files to pyc files that can then be
> run without access to the source (the py).
>
> Would Perl 6 be able to do this? Compile the pl to plc and pm to pmc and
> load the ??c version if it was available and newer than the
> source?

I suppose that means implementing for perl6 the equivalent of
ccache. I doubt that, in general, the preferred form of a dynamic
programming language is the bytecode one.

>
> Other than code hiding would there be any performance benefits?
>

There is the age old debate about the dubious benefits of source
code hiding.

--
stef

Dan Sugalski

unread,
Oct 27, 2004, 9:07:32 AM10/27/04
to Peter Hickman, Perl 6 Internals
At 12:00 PM +0100 10/27/04, Peter Hickman wrote:
>Presently Python compiles it's py files to pyc files that can then
>be run without access to the source (the py).
>
>Would Perl 6 be able to do this? Compile the pl to plc and pm to pmc
>and load the ??c version if it was available and newer than the
>source?

Yeah, that's doable. Probably will be done.

>Other than code hiding would there be any performance benefits?

Given that the bytecode will probably have a segment with the
original source in it, this isn't likely to get you much of a win
there.

There should be a performance win, though. There won't be a need to
compile the source, which saves some time. Bytecode files on-disk are
shared across all the processes in the system, so you only get one
in-memory copy of a file, which saves both RAM and load time if
you're using a file that another process is using.

On single user or small machines this probably won't be a big win in
most cases. It should, however, make a pretty big difference in
server systems.
--
Dan

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

Peter Hickman

unread,
Oct 27, 2004, 9:19:38 AM10/27/04
to Perl 6 Internals
Dan Sugalski wrote:

Thanks for that, I was pretty sure that it should have been doable.

Thanks

Gisle Aas

unread,
Oct 27, 2004, 9:24:51 AM10/27/04
to Dan Sugalski, Peter Hickman, Perl 6 Internals
Dan Sugalski <d...@sidhe.org> writes:

> Bytecode files on-disk are
> shared across all the processes in the system, so you only get one
> in-memory copy of a file, which saves both RAM and load time if you're
> using a file that another process is using.

I assume this means that the plan is to mmap these files. Are most
systems happy with hundreds (or thousands) of mapped sections of
memory or are there some negative performance implications of doing
that?

How about the code JITed from the bytecodes. Will it be shared?

Regards,
Gisle

Dan Sugalski

unread,
Oct 27, 2004, 9:57:01 AM10/27/04
to Gisle Aas, Peter Hickman, Perl 6 Internals
At 6:24 AM -0700 10/27/04, Gisle Aas wrote:
>Dan Sugalski <d...@sidhe.org> writes:
>
>> Bytecode files on-disk are
>> shared across all the processes in the system, so you only get one
>> in-memory copy of a file, which saves both RAM and load time if you're
>> using a file that another process is using.
>
>I assume this means that the plan is to mmap these files. Are most
>systems happy with hundreds (or thousands) of mapped sections of
>memory or are there some negative performance implications of doing
>that?

Most systems I know about are unhappy with hundreds or thousands of
mmaped segments per-process, but that's generally not a problem for
that many segments for the system as a whole. I think that mmap
shares underlying code paths with the code to map in shared libraries
most places, so we shouldn't have to worry about it. If things fail,
we can always fall back to an alternate plan.

>How about the code JITed from the bytecodes. Will it be shared?

Unfortunately not, no. It wouldn't be a bad idea to expand the
bytecode files to allow executable segments that could be used in
trusted situations.

Jeff Clites

unread,
Oct 27, 2004, 12:56:54 PM10/27/04
to Gisle Aas, Dan Sugalski, Perl 6 Internals, Peter Hickman
On Oct 27, 2004, at 6:24 AM, Gisle Aas wrote:

> How about the code JITed from the bytecodes. Will it be shared?

The JITed code can't be shared directly--in it's current form, it
(intentionally) includes absolute addresses which wouldn't be valid for
other processes.

But the exec core allows (or, will allow) bytecode to be compiled into
a native executable (or presumably, library), so that would allow the
advantages of native, memory-shared code.

JEff

0 new messages