in reply to Re^4: Should I just print my own HTTP headers?
in thread Should I just print my own HTTP headers?

But according to this test, printing one header by hand is 11331% more efficient than using CGI to do it. Did I miss something?

Two things:

Latency and throughput are much, much more important performance characteristics in such an application, and it's highly unlikely you'll optimize those to the degree that microoptimizations to save milliseconds in program startup time will have any benefit.

The only applicable scenario for this type of optimization is where you're running the program on your own machine and can't run it in a persistent process... but I can't imagine any use for that.

  • Comment on Re^5: Should I just print my own HTTP headers?

Replies are listed 'Best First'.
Re^6: Should I just print my own HTTP headers?
by Cap'n Steve (Friar) on Apr 11, 2007 at 05:22 UTC
    No useful program will ever print out 100,000 HTTP headers on purpose and exit. That'd be like me benchmarking various ways to roll a cigarette--completely useless because I don't smoke.
    Obviously not, but it's it's quite likely that the program that prints 1 header will be run 100,000 times. I kind of wish this thread would just die since it keeps costing me experience points, but let me sum up like this: Is "it doesn't take all that long to load" really a good argument to advocate the use of a module? I'm sure CPAN is full of quick loading modules, but why would I use them if I don't need to?
      ... it's it's quite likely that the program that prints 1 header will be run 100,000 times.

      Then why not profile the entire program, including network IO, to see if the cost of loading the module is even significant?

      Is "it doesn't take all that long to load" really a good argument to advocate the use of a module?

      The real question is "Without actually measuring, is worrying that a module might take too long to load sufficient justification to write my own minimal replacement?"

      A reply falls below the community's threshold of quality. You may see it by logging in.
Re^6: Should I just print my own HTTP headers?
by BrowserUk (Patriarch) on Apr 09, 2007 at 22:29 UTC

    Question: Why continue to advocate the use of a module that carries the weight of all that extraneous functionality, when it seems that everybody who has any expertise in perl/cgi applications adamantly decries the use of so much of it in favour of templating? Especially when there is a drop-in, cut-down replacement derived from it, that does away with that weight?


    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.

      I prefer CGI::Simple as well, but if the choice is between using a core module and writing bizarre and meaningless benchmarks to "prove" that the core module is Just Too Heavy to use, I'll take the core module.

        bizarre and meaningless benchmarks

        Which benchmark is that?

        Update. There are two posts in this thread that could be called benchmarks. I just wondered which one you meant.


        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.