in reply to Optimise Perl code pl file

Not a simple task. You can have a look at the B family of modules ...

  • B::Concise (walk Perl syntax tree, printing concise info about ops)
  • B::Deparse (produce perl code)
  • B::Generate (generate your own op trees)

    Personally I think the idea is a bit 'crazy'. However I believe it is possible to produce some sort of dead-code elimination algorithm. The following is just my idea on how this might be done.

    +-------------------------+ | generate perl-byte code | | of the entire project | +------------+------------+ | +------------+------------+ | walk the op-tree and | | identify unused opcodes | +------------+------------+ | +---------------------+ | construct your own | | op-tree without the | | unused op-codes | +---------------------+
  • Replies are listed 'Best First'.
    Re: Re: Optimise Perl code pl file
    by diotalevi (Canon) on Nov 28, 2003 at 16:34 UTC
      That's pointless. When perl optimizes away an opnode, it just stops pointing to it. Null nodes have no runtime impact since they are never seen by the interpreter. They still consume a bit of memory and are still present but you only ever see them when you dump the optree.