Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re(2): which is faster, interpolation or concatenation?

by Arien (Pilgrim)
on Sep 09, 2002 at 22:43 UTC ( [id://196469]=note: print w/replies, xml ) Need Help??


in reply to Re: which is faster, interpolation or concatenation?
in thread which is faster, interpolation or concatenation?

There are situations (like a mod_perl CGI under rapid fire) where you need every bit of speed you can get.

After profiling you may find that the performance you are looking for cannot be achieved using your setup. More memory, changing the Apache/mod_perl configuration, a faster processor, more processors, or not doing the bottleneck in Perl (if that's where the bottleneck is) are some of the ways to help you get there.

It might be but a loop or subroutine that's part of a (much) larger project, so "don't use perl if you need speed" is quite an ignorant advice.

Just to make sure: that advice wasn't given.

antichef asked us what's faster in Perl, he didn't ask whether Perl was fastest in the first place...

Assuming he has a performance problem (and not just some theoretical curiosity), maybe he should have. Besides, one form could be rewritten to the other by the optimizer in another Perl version, so what's the point?

— Arien

Replies are listed 'Best First'.
Re: Re(2): which is faster, interpolation or concatenation?
by antichef (Acolyte) on Sep 10, 2002 at 04:06 UTC
    OK - thanks everyone. Here's why I asked: I wrote and run a site - spamgourmet.com, which is a disposable email address service. I wrote the code and most of the supporting website (all perl) in a couple of weekends. The service now has many thousands of users and processes a great deal of mail every day.

    The site has been up for almost two years, during which it has cost me $10 per month. I'm still nowhere close to exceeding the limits placed on my account by my hosting company (he.net - gushing endorsement goes here), and I look forward to keeping it that way. I've also sworn to myself and anyone else who'll listen that the service will always be free - that is, not a source of revenue for anybody. (I suppose I plan to simply stop accepting new users when I hit the ceiling, and then encourage others to take up the cause for new users.) Sales of t-shirts, coffee mugs, etc. during this period have netted $17.01 - not enough for cafepress.com to dislodge a check. I've also received a $10 donation. I couldn't care less. To justify this position to (the many) naysayers in my day-to-day life, I can truthfully say that I spend about as much time and money on the service as going to the movies once a month.

    The codebase is small - I've open-sourced it, but I'm not aware of anyone using or extending the code, so my focus is more on keeping the users happy, and keeping the service cheap - so, yes, I'm counting bits. Nevertheless, my aim to maintain balance in these things discourages me from using the scientific method too liberally...

    So I came here seeking wisdom. I've been told that string concatenation is a real killer in java. I suspected the same was not true in Perl, but I thought I'd ask here, and my suspicion has been abundantly confirmed. Thanks again.

Re^3: which is faster, interpolation or concatenation?
by Flexx (Pilgrim) on Sep 10, 2002 at 11:08 UTC

    Hi Arien,

    It might be but a loop or subroutine that's part of a (much) larger project, so "don't use perl if you need speed" is quite an ignorant advice.
    Just to make sure: that advice wasn't given.

    No hard feelings! Somehow I read it that way, but I understand that you didn't mean it that way. My bad.

    Look, I gave a pointer to more information on the question being asked. antichef didn't state what's behind his question, so any assumtion on that is just that -- an assumtion. The only thing he has stated was that he did not worry about readability but for speed only, and he got several "don't/bad boy/shame on you" answers. I gave him a pointer to information he was asking for -- so what did I do wrong?

    I didn't mean to object on any of the advice given, on the contrary, I agreed in principle.

    Besides, one form could be rewritten to the other by the optimizer in another Perl version, so what's the point?

    Fine. But what's the point in your objection? Right now, one way might indeed be faster than the other, and brother antichef was courious. I don't know what's wrong with that. Those who know me, know that I am on a crusade for good style and ethics myself, but it's still ok to be courious!

    So long
    Flexx

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://196469]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2024-03-28 12:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found