develooper Front page | perl.perl5.porters | Postings from February 2004

Re: op_seq (was: Freeing code)

Thread Previous | Thread Next
From:
Paul Johnson
Date:
February 20, 2004 17:32
Subject:
Re: op_seq (was: Freeing code)
Message ID:
20040221013147.GB6953@pjcj.net
Here's something I've had on my TODO list for slightly over a year.  I
sent a test patch last year, fishing for comments, but no one bit.  So
here's the real thing.

op_seq uses sixteen bits, as does op_type.  op_seq only needs to hold
three states, and op_type only needs nine bits.  This means that we
could store all the information we need in eleven bits, save sixteen
bits per op and still have five bits spare for future use.

The attached patch does just that.  All the tests still pass on my i386
linux box and the memory requirements of the following program are
reduced by almost 2.5%.

    use POSIX;
    use CGI;
    use IO;
    use Encode;
    use Storable;
    use Switch;
    use Getopt::Long;

Obviously the reduction in memory usage depends on the proportion of ops
to other data.

Notes:

- perl regen.pl needs to be run.  In fact, it needs to be run anyway,
  whether or not this patch is applied.
- Of course, binary compatibility is completely shot.
- So is Devel::Cover.  I'm not aware of any other CPAN modules which use
  op_seq, but there probably are some.
- Fake sequence numbers are provided for -Dx output, in a similar
  fashion to that which Stephen McCamant implemented for B::Concise.
  The order of the numbers assigned to the ops, and which ops are
  assigned sequence numbers, results in slightly altered -Dx output.
  This doesn't seem important to me, but extra work could be put into
  the dump routines to make the output more similar.  Or some of the
  complexity could be removed if slightly greater changes were
  acceptable.
- I can detect no change in execution speed.
- perlcc works as well as it did before.
- 88 of the test.bytecode target tests fail.  This is the same as before.
- The bytecode still stores op_type in sixteen bits and each of op_opt
  and op_static in eight bits.  This could obviously be improved.  Does
  anyone still care about this?

-- 
Paul Johnson - paul@pjcj.net
http://www.pjcj.net

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