Hey all,

If you've been in the CB within the past 24 hours, you've probably at least heard of Funny Farm, a pretty sweet little game by Igor Naverniouk.

Looking around his site, i found on his UVA tools page that he says, and i quote:

ShyGypsy labs August 4, 2006 02:19 I'm playing around with some better ways of ranking people and problems. Here is a preview of a prototype. I have also discovered that I can easily write CGI scripts in C++. Perl is great, but I can get stuff done a hundred times faster in C++.
"I can get stuff done a hundred times faster in C++"? Did I miss something? If I recall correctly, comparatively it takes at least 5-6 lines more of code in C++ that in perl to write a simple "Hello world" program.

Example:

C++:

#include <iostream> using namespace std; int main () { cout << "Hello World!"; return 0; }

Perl:

#!/usr/bin/perl -w use strict; print "Hello world!\n";

or, even less:

C:\>perl -e "print 'hello world!'"

I'm not trying to dig up an old Jihad, and I normally would just search the site for responses on this, but what could possibly justify him saying that? It could very well be that he's more comfortable with C++ and can simply code quicker in C++, logically that's sound because he's got 2 C++ courses he teaches at UofToronto, but I just can't fathom this.

Another possiblity is he has many code libraries in C++, mainly algorithms and such, and maybe that puts C++ on a more level playing field with perl since it eliminates a lot of low end coding. But do libraries really making a "100 times faster" difference?

Please, correct me, downvote me, chastise me if I'm off base and haven't done my research, but I just can't possibly see how coding in C++ could possibly be any faster than coding in perl

Your wisdom is appreciated monks.

P.S> I just threw this in meditations, move as needed.

meh.

Replies are listed 'Best First'.
Re: C++ vs. Perl mention on shygypsy.com
by adrianh (Chancellor) on Oct 23, 2006 at 00:23 UTC
    Please, correct me, downvote me, chastise me if I'm off base and haven't done my research, but I just can't possibly see how coding in C++ could possibly be any faster than coding in perl

    Maybe he's talking about speed of the code rather than speed of writing the code?

    I'm also quite happy to accept that somebody more familiar with C++ than Perl could code up something more quickly in C++.

    That doesn't mean that somebody more familiar with Perl couldn't write the equivalent more quickly in Perl. He's not talking about Perl in general - just what he can do.

      I can agree with that, that C++ is quicker when executed that perl, but I don't think he meant that when he said he could get stuff done faster in C++. Perhaps I misread.

      meh.
Re: C++ vs. Perl mention on shygypsy.com
by castaway (Parson) on Oct 23, 2006 at 07:41 UTC
    "Perl is great, but I can get stuff done a hundred times faster in C++."

    This seems like a simple case of him knowing C(++) better than Perl, since that's all he said..

    C.

Re: C++ vs. Perl mention on shygypsy.com
by wazoox (Prior) on Oct 23, 2006 at 11:23 UTC
      This interesting article .. isn't very kind to C++ :)

      I once saw it written that C++ suffers only 2 drawbacks - namely, the concept, and the implementation. I don't know if that's an accurate assessment, but I'm more than happy to accept it.

      I think, however, that if the same comments were to be made wrt C, then I would object quite strongly.

      Cheers,
      Rob

      Not very kind, but when the author says (in reference to Java’s R(emote)M(ethod)I(nvocation) mechanism) "If you wanted to implement something comparable in C++, however, you would need to throw away the C++ method-call mechanism and replace it with your own custom message-passing system. Each C++ class would implement a single handleMessage() method, which would then call the "real" methods. By the time you’ve done this, you’ve thrown away a lot of the convenience of using C++ in the first place.", I find that very true. You do do a lot of having to throw away many of the features of C++ when doing something like this. C++ is great OO-wise, in my opinion, but it seems like it would have trouble with flexibility when dealing with "new" technologies.

      meh.
Re: C++ vs. Perl mention on shygypsy.com
by Anonymous Monk on Oct 23, 2006 at 13:47 UTC
    If I recall correctly, comparatively it takes at least 5-6 lines more of code in C++ that in perl to write a simple "Hello world" program.

    Yes, and? Unless one is either brilliant, or writes only trivial (or buggy) programs, ones programming speed isn't bounded by ones typing speed.

    I can write most programs faster in Perl than in C, but I write more lines/hour programming in C than in Perl; even while my C gets a lots less practise than my Perl.

    And if the author of the article is more efficient in C++ than in Perl, why get worked all over it? It's his code, his time, his application.

      I'm not really getting "worked" over it, I was just a bit astounded that someone could write something faster in C++ than perl, not factoring in libraries and classes, etc. I guess exponentially, once one got things rolling in C/C++ they could be more "productive", but I haven't written a large enough C/C++ program to know this first hand.

      UPDATE:Perhaps comparing lines of code wasn't the angle i wanted to take, as AnonyMonk said, one's typing speed isn't a binding when it comes to writing worthwhile code. I was thinking more along the lines of set up vs. actual meat code that allows you to get into the thick of what you want your code to really do, perl seems to let you do this fairly quickly, especially compared to C++.

      meh.
Re: C++ vs. Perl mention on shygypsy.com
by Anonymous Monk on Sep 05, 2008 at 20:24 UTC
    Hi, dhoss,

    You could have just sent me an email and asked. :) As others have already mentioned, the "I" in "I can get stuff done..." is important. I have a lot more experience writing C++ than I do with Perl.

    I also find C++ much simpler than Perl. This may sound preposterous. C++ is an incredibly complicated language. I would guess that fewer than 1% of programmers actually know the complete syntax of C++! I can only think of one language that is more complicated -- Perl.

    Perl's motto ("There is more than one way to do it.") was an interesting design choice. Learning Perl for simple tasks is great fun. Learning all of Perl, completely, is almost impossible for mortals. Its brevity is astounding. (Just look at some of the Perl solution lengths on http://spoj.pl) Its complexity is even more astounding.

    For the record, nowadays, I do most of my web programming in Python either on the Google App Engine or on plain old Apache.

    igor

      Hey there Igor!

      Thanks for the reply. That's a great game by the way...and I need to get back into it.

      The "cause" of my post was probably due to my lack of knowledge of getting things done from a programming/development standpoint. I hadn't been versed in as large of a codebase/knowledgebase as I have now, so my understanding wasn't complete.

      I understand now your reasoning behind C++ being useful for getting things done. With perl, it's a wonder to me *how* things even ever get done once a certain point is reached.

      I appreciate the reply! I'll be sure to email you inthe future :-)

      -Devin

      meh.