in reply to Re^4: Play Template
in thread Play Template

Where would you have me announce it? Or are we just playing forum chicken to see who will hit the right edge of the page first?

You could send me a /msg. Or better, you could simply follow the conventions of the forum you are using--that have served the Monastery perfectly well for almost a decade--and post replies as replies, rather than as cowardly, secret updates to your own nodes.

You are crushed.

Oooh. I'm sooo crushed. Woe isth me.

The benchmarks you published showing an improvement of nearly 4000% were either cooked

So, you're calling me a liar? I published my benchmark code so the results posted can be verified.

I'm not going to lecture the Monastery on the significance of these results.I post three sets of results so you can judge for yourself the consistency of my experimental method.

How can we "judge" anything about your benchmarks when you are too cowardly to publish the code.

For the rest of your diatribe...words fail me.

Tip: Before you set about educating others, it is better if you have some understanding of your subject.


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.
RIP an inspiration; A true Folk's Guy
  • Comment on Re^5: Play Template (Cowardly, unannounced update 2)

Replies are listed 'Best First'.
Re^6: Play Template
by Xiong (Hermit) on Aug 12, 2010 at 19:53 UTC

    I have nothing more to say on this topic. But I cannot refuse a reasonable request to publish my method of obtaining results.

    Code follows. I ran the script on my MPC TransPort X3100, an obsolete laptop upgraded with a Pentium (R) M, with 2 Gb memory. Continued operation at top speed quickly overheats the chip, so I fixed the CPU frequency during these tests to 1.60 GHz. Interpreter version is 'v5.10.1 (*) built for i686-linux-thread-multi'. OS is Ubuntu 9.10, Linux 2.6.31-19-generic. I did my best to idle other tasks while benchmarking but I did not shut down X.

    In the script, I bypass the ::XS enhancement with declarations of the form:

    Readonly my $n_true => 1;

    ... instead of the correct:

    Readonly::Scalar my $r_true => 1;

    While I admit to some doubt as to why ::XS applies to one set of declarations and not the other; and have some small feeling that I would prefer to compare performance with ::XS loaded against that when it is completely not loaded; I'm confident that the usingNo_XS() routine reasonably reflects performance when ::XS is not available.

    I noted earlier that you obtained the performance expected without ::XS even using the correct syntax; and therefore, you likely did not have Readonly::XS installed. You replied with, among other stuff, what looked very much like an effort to install it, whereupon your performance improved significantly, as expected. I don't understand why you're not pleased.

    I cannot imagine personally fighting a pitched, cross-thread battle over a 2x difference in performance. I can imagine someone else doing so over a 40x difference, which results you showed previously (and which I preserve below). I do not, Sir, call you a liar. I merely fail to replicate your results.

    You are /msg-ed.

    #! /run/bin/perl #~ use strict; use warnings; use Benchmark qw[ cmpthese ]; use constant { C_TRUE => 1, C_FALSE => 0, C_VALUE => 12345, }; use Readonly; # Correct... Readonly::Scalar my $r_true => 1; Readonly::Scalar my $r_false => 0; Readonly::Scalar my $r_value => 12345; # Much slower... Readonly my $n_true => 1; Readonly my $n_false => 0; Readonly my $n_value => 12345; # My... my $m_true = 1; my $m_false = 0; my $m_value = 12345; # Package variables... $p_true = 1; $p_false = 0; $p_value = 12345; sub usingConstant { for( 1 .. 1e6 ) { if( C_TRUE ) { my $sum = C_VALUE * C_VALUE; } elsif( C_FALSE ) { ;## Never called } } } sub usingReadonly { for( 1 .. 1e6 ) { if( $r_true ) { my $sum = $r_value * $r_value; } elsif( $r_false ) { ;## Never called } } } sub usingNo_XS { for( 1 .. 1e6 ) { if( $n_true ) { my $sum = $n_value * $n_value; } elsif( $n_false ) { ;## Never called } } } sub usingPackage { for( 1 .. 1e6 ) { if( $p_true ) { my $sum = $p_value * $p_value; } elsif( $p_false ) { ;## Never called } } } sub usingMy { for( 1 .. 1e6 ) { if( $m_true ) { my $sum = $m_value * $m_value; } elsif( $m_false ) { ;## Never called } } } sub usingLiterals { for( 1 .. 1e6 ) { if( 1 ) { my $sum = 12345 * 12345; } if( 0 ) { ;## Never called } } } cmpthese -20, { const => sub{ usingConstant() }, Readonly => sub{ usingReadonly() }, My => sub{ usingMy() }, literals => sub{ usingLiterals() }, package => sub{ usingPackage() }, No_XS => sub{ usingNo_XS() }, }; __END__ c:\test>ROvCONST.pl s/iter Readonly const Readonly 5.66 -- -98% const 0.141 3931% -- (including No_XS; 1.60 GHz fixed) No_XS 0.159/s -- -94% -94% -94% -96% -97% My 2.76/s 1638% -- -1% -3% -36% -40% Readonly 2.79/s 1661% 1% -- -2% -35% -39% package 2.86/s 1700% 4% 2% -- -34% -38% literals 4.33/s 2630% 57% 55% 52% -- -6% const 4.60/s 2796% 67% 64% 61% 6% -- Rate No_XS Readonly My package literals const No_XS 0.161/s -- -94% -94% -95% -96% -97% Readonly 2.76/s 1619% -- -2% -8% -37% -42% My 2.82/s 1659% 2% -- -6% -35% -40% package 2.99/s 1764% 8% 6% -- -31% -37% literals 4.36/s 2618% 58% 55% 46% -- -8% const 4.73/s 2847% 71% 68% 58% 8% -- Rate No_XS Readonly My package literals const No_XS 0.158/s -- -94% -94% -95% -96% -97% Readonly 2.80/s 1666% -- -2% -6% -37% -41% My 2.85/s 1697% 2% -- -5% -36% -40% package 2.99/s 1785% 7% 5% -- -33% -37% literals 4.47/s 2723% 60% 57% 50% -- -5% const 4.73/s 2885% 69% 66% 58% 6% --
    Note: Contents may change.