develooper Front page | perl.perl5.porters | Postings from July 2010

Re: Order of evaluation of terms (was peephole optimiser couldprune more dead code)

Thread Previous | Thread Next
From:
Paul LeoNerd Evans
Date:
July 20, 2010 08:49
Subject:
Re: Order of evaluation of terms (was peephole optimiser couldprune more dead code)
Message ID:
20100720154933.GE11110@cel.leo
On Fri, Jul 16, 2010 at 12:18:48AM +0200, demerphq wrote:
> I wonder if we should arrange for a debugging mode where the order
> that terms were evaluated was reversed, or randomized, or whatever. It
> would be educational I think to find out just how much breaks.

I once pondered a Test:: module that would run a given body of code
twice, with some optimisation flag turned on and off, to check if e.g.
an XS vs. PurePerl implementation of the function does the same thing.
Essentially a

 for $MyModule::DoOptimisation ( 0, 1 ) {
   is( MyModule::meaning_of_life, 42, 'Meaning of life' );
 }

Perhaps by taking a code block a.la. Test::Exception primatives, these
could be turned into more generic testprim factories. Perhaps test some
code a number of times for various randomisations of hash key ordering,
to test against dependency of key order, that sort of thing... I could
see similar being very useful here too.

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk
ICQ# 4135350       |  Registered Linux# 179460
http://www.leonerd.org.uk/

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