http://www.perlmonks.org?node_id=989326


in reply to Perl 5 Optimizing Compiler, Part 3: I Have A Dream

My Impossible Plan to implement this Impossible Dream would be to take a subset of Perl5 that can be parsed statically and implement that. Basically what PHP should have been if it was run by people who knew what they were doing.

From there, you can integrate the new implementation into the CPAN testing system. Try to get the major module authors to commit to passing their releases under the new system.


"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

Replies are listed 'Best First'.
Re^2: Perl 5 Optimizing Compiler, Part 3: I Have A Dream
by Will_the_Chill (Pilgrim) on Aug 23, 2012 at 20:23 UTC
    We can't ever have a requirement of other people needing to re-write their existing Perl 5 code to run with our stuff, it would be political death within the coding community. We need to be 100% backwards-sideways-forwards compatible with all Perl 5 code.

    Exactly how to achieve that is what remains to be determined.
      Banning eval's visibility of lexicals is the number 1 way to optimize perl to C speed. You have to compile out the "english". Also banning magic would allow common subexpression elimination and convert SVs into more C like data/machine words. Reducing usage of the perl stack might be a worth idea to pursue. Considered taking a profiler to all the perl opcodes and see which are the slowest? I've modified NYTProf for myself to time per opcode times (part of NYTProf's CORE:: profiling system). There is a list in some header of NYTProf which says which opcodes to profile.

      A random idea I thought of today is, stop pp_sassign for target aware opcodes. sv_setsv does bail out almost instantly if source and dest SV*s are the same, but pp_sassign goes through alot of code until it calls sv_setsv.

      Sadly, your best bet is to write a Perl 5 to .NET CIL or Java bytecode compiler since pretty much all CPUs nowadays are tuned to running one of those 2 VMs.
        Sadly, your best bet is to write a Perl 5 to .NET CIL or Java bytecode compiler since pretty much all CPUs nowadays are tuned to running one of those 2 VMs.

        Elaboration or pointers?


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        The start of some sanity?