This and other RFCs are available on the web at
  http://dev.perl.org/rfc/

=head1 TITLE

Cache byte-compiled programs and modules

=head1 VERSION

  Maintainer: Simon Cozens <[EMAIL PROTECTED]>
  Date: 25 Sep 2000
  Mailing List: [EMAIL PROTECTED]
  Number: 301
  Version: 1
  Status: Developing

=head1 ABSTRACT

Python does it. Java does it. It's time we did it.

=head1 DESCRIPTION

When Perl runs a program, it's compiled to bytecode and then the
bytecode is executed. Now, what you could easily do is stop after
compiling and dump out the bytecode to save you compiling it next time
the program is run. In Perl 5, this is slow, because it's quicker to
recompile than to read in the bytecode. In Perl 6 it'll be quick, and
I'll have some suggestions as to how to speed it up soon.

So, we check for the existence of a C<.plc> file before running a
program; if the C<.plc> file is newer than the program, we use that
instead. If there isn't a C<.plc> file or it's older than the program,
recompile and dump the bytecode to a C<.plc> file. Naturally, this gives
us the best speedup for modules which change very, very infrequently,
rather than programs which can change a lot during development. Maybe
you only want to do this for modules, then.

=head1 IMPLEMENTATION

Perl 5.6 has the elements of support for C<.plc> files, but it doesn't
tell anyone about this: have a look at C<pp_require> in F<pp_ctl.c>.
(Hmm, it's not in 5.7.0, but I could have sworn I've seen it in there in
the past.) 

I also threw out a module called C<ByteCache> onto p5p a few months ago,
which implemented the thing as a coderef on C<@INC>. Implementing it in
C<pp_require> is a cleaner way of doing it, however.

=head1 REFERENCES

None.

Reply via email to