Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Why is Apache::File 'twice as fast' as IO::File ?

by graq (Curate)
on Jun 26, 2003 at 10:56 UTC ( #269181=perlquestion: print w/ replies, xml ) Need Help??
graq has asked for the wisdom of the Perl Monks concerning the following question:

From Apache::File:
Apache::File does two things: it provides an object-oriented interface to filehandles similar to Perl's standard IO::File class. While the Apache::File module does not provide all the functionality of IO::File, its methods are approximately twice as fast as the equivalent IO::File methods. Secondly, when you use Apache::File, it adds several new methods to the Apache class which provide support for handling files under the HTTP/1.1 protocol.
Does anyone know why this is, how the author comes to this conclusion?

[Graq]

Comment on Why is Apache::File 'twice as fast' as IO::File ?
Re: Why is Apache::File 'twice as fast' as IO::File ?
by Anonymous Monk on Jun 26, 2003 at 11:24 UTC

    Probably because the guys and gals at Apache recognise the importance of performance, and take the time to optimise their code.

    As distinct from the wider perl community, if most of those around this site are anything to go by, who don't bother to. After all, "hardware is cheap!".

    They don't seem to realise the damage it causes to the Perl's reputation when potential commercials users put together a POC using half a dozen CPAN modules, each of which is profligate with both time and memory, and run it along side a similar app written in Java, and waddaya know. The perl app runs 10 times slower.

    So optimise it!

    Ah, but the culprits are the layers of standard and cpan modules that we cannot modify because its standard co. policy not to modify 3rd party software. Perl's rep takes another hit, and Java gets the gravy.

      Probably because the guys and gals at Apache recognise the importance of performance, and take the time to optimise their code.

      Nope. It's because the Apache::File module is aimed at a specific task and IO::File is part of a generic IO system. Apache::File is faster because it doesn't do all the things that IO::File does.

      As distinct from the wider perl community, if most of those around this site are anything to go by, who don't bother to. After all, "hardware is cheap!".

      That's not been my experience. Can you give some examples?

      (And the mod_perl folk are a big part of the perl community :-)

      They don't seem to realise the damage it causes to the Perl's reputation when potential commercials users put together a POC using half a dozen CPAN modules, each of which is profligate with both time and memory, and run it along side a similar app written in Java, and waddaya know. The perl app runs 10 times slower.

      Again, that's not been my experience. Usually I find that Perl and Java applications are well within an order of magnitude of each other speed wise. Sometimes Java is faster. Sometimes Perl is faster. The difference is usually not enough to sweat about.

      In fact it's more common for me to find that I have to throw more hardware at Java applications because of the overhead of J2EE et al.

      Can you point us to some commonly used CPAN modules that you think are particularly poor performance wise?

      Yes, there are always some instances where language X is going to be faster than language Y for some task. However, in the domain I spend a lot of time (web applications and data munging) they both seem to perform equally well.

      In my experience those potential commercial users are more impressed by the fact that they're playing with the Perl proof of concept three weeks before the Java one is finished :-)

      Ah, but the culprits are the layers of standard and cpan modules that we cannot modify because its standard co. policy not to modify 3rd party software.

      Because a company has a foolish policy this is Perl's fault how?

      Most modules are licensed so that you can take them and change them as you want. You can just fork a new version if you need more performance. Since perl is dynamically typed you can write your "efficient" object with the same API and have it play happily with the rest of the application.

      Java's not exactly been free of poor package implementations either has it? And you don't have the source available to fix them ;-)

Re: Why is Apache::File 'twice as fast' as IO::File ?
by derby (Abbot) on Jun 26, 2003 at 11:35 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://269181]
Approved by broquaint
Front-paged by Tanalis
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2014-07-13 23:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (252 votes), past polls