Loading ...
Sorry, an error occurred while loading the content.

Re: [BUG] Inconsistent $r->print() behavior with references

Expand Messages
  • Jonathan Field
    ... Measurable, but also negligable (code below): Benchmark: timing 50000 iterations of ref, val... ref: 3 wallclock secs ( 2.72 usr + 0.12 sys = 2.84 CPU)
    Message 1 of 35 , Dec 2, 2003
    View Source
    • 0 Attachment
      > My intuition tells me that the performance gain is not mesureable anyway.

      Measurable, but also negligable (code below):

      Benchmark: timing 50000 iterations of ref, val...
      ref: 3 wallclock secs ( 2.72 usr + 0.12 sys = 2.84 CPU) @ 17605.63/s (n=50000)
      val: 7 wallclock secs ( 6.05 usr + 0.18 sys = 6.23 CPU) @ 8025.68/s (n=50000)

      Since each of our servers is handling less than 20 requests per second
      (requests of this type, anyways) we wouldn't gain much with this
      optimization. I'm still the type that's always looking for a good
      performance tweak, though :) I will look through the performance
      guidelines some more, though I think I've already applied them all :)

      Thanks for your input!
      Jonathan Field

      #---------------------------------------
      # Benchmark code (hope my logic here is reasonable):
      #---------------------------------------

      #!/usr/local/bin/perl
      use strict;
      use warnings;
      use Benchmark;

      our $string = "a" x 1024 x 100; # simulate a 100KB HTML file
      open FILE, ">/dev/null" or die $!; # simulate an very fast connection ;)
      our $fh = \*FILE;

      timethese(50000, {
      'ref' => \&refcpy,
      'val' => \&valcpy,
      });

      sub refcpy {
      my $ref = \$string;
      print $fh $$ref;
      }

      sub valcpy {
      my $val = $string;
      print $fh $val;
      }



      --
      Reporting bugs: http://perl.apache.org/bugs/
      Mail list info: http://perl.apache.org/maillist/modperl.html
    • Jonathan Field
      Thanks, all, for the prompt attention. I will update my coding habits accordingly :) Cheers ... -- Reporting bugs: http://perl.apache.org/bugs/ Mail list
      Message 35 of 35 , Dec 10, 2003
      View Source
      • 0 Attachment
        Thanks, all, for the prompt attention. I will update my coding habits
        accordingly :)

        Cheers

        On Wed, 10 Dec 2003, Stas Bekman wrote:

        > I've pinged Doug and the final verdict is this:
        >
        > The print-a-scalar-reference feature is now deprecated. There are
        > known bugs when using it and it's not supported by mod_perl 2.0. If
        > you have a scalar reference containing a string to be printed,
        > dereference it before sending it to print.
        >
        > It's now documented as such.
        >
        > Jonathan, please adjust your code to dereference the scalar references before
        > sending them to print.
        >
        > __________________________________________________________________
        > Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
        > http://stason.org/ mod_perl Guide ---> http://perl.apache.org
        > mailto:stas@... http://use.perl.org http://apacheweek.com
        > http://modperlbook.org http://apache.org http://ticketmaster.com
        >


        --
        Reporting bugs: http://perl.apache.org/bugs/
        Mail list info: http://perl.apache.org/maillist/modperl.html
      Your message has been successfully submitted and would be delivered to recipients shortly.