Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Perl vs C

by halfcountplus (Hermit)
on Mar 15, 2009 at 04:56 UTC ( #750700=note: print w/ replies, xml ) Need Help??


in reply to Re: Perl vs C
in thread Perl vs C

"Whatever is possible to be achieved using C is achieved using perl also.

Don't be insane. This is so obviously far from the truth as to be ridiculous.

Perl is beautiful but SPECIALIZED. You will (almost) never realize the execution speed of C in perl which is why people do not write (eg) 3D API bindings for perl.

What is the acronym for again, anyway?


Comment on Re^2: Perl vs C
Re^3: Perl vs C
by chromatic (Archbishop) on Mar 15, 2009 at 08:36 UTC
    You will (almost) never realize the execution speed of C in perl....

    That depends on what you're doing. If you want to compare the languages themselves (okay, you can use C's standard library), I can suggest several algorithms and data structures and tasks which will be as fast in Perl as in C.

    ... which is why people do not write (eg) 3D API bindings for perl.

    A far larger problem is data marshalling instead of opcode dispatch.

    What is the acronym for again, anyway?

    Perl is not an acronym.

      I can suggest several algorithms and data structures and tasks which will be as fast in Perl as in C.
      I keep seeing people say this, but I've never managed to see it happen. Usually Perl is fast enough, but I've never managed to outperform the equivalent C program. Could you please provide some examples of what is faster in Perl than C, because I really am interested.

        Many of these algorithms are for arbitrary string searching; it's difficult to outperform Perl's regex engine. (Please note that the portion of my post which you did not quite implied that you can't pull in PCRE.) I suspect, but can't immediately prove, that code heavy with malloc/free temporary data may reach a point where it's faster in Perl than in C, but that depends on overcoming the overhead of op dispatch in Perl.

Re^3: Perl vs C
by plobsing (Friar) on Mar 15, 2009 at 16:26 UTC
    people do not write (eg) 3D API bindings for perl.

    Oh really?

    Of particular interest:

    Due to Perl's strength in string manipulation, there are cases where Perl can even outperform C when loading/manipulating shader programs.

Re^3: Perl vs C
by ForgotPasswordAgain (Deacon) on Mar 15, 2009 at 17:53 UTC

    I wrote bindings for OGRE. I found them to be fairly fast, actually, though of course most of the execution is done in C++ land.

    You probably don't mean Perl specifically, but interpreted languages generally. But from what I see, a lot of times there are no bindings for Perl when there are for Python and Ruby. I think the reason for not writing bindings is not the speed (Perl is probably faster than Ruby, I don't know about Python) but rather the ease of writing the bindings. For example, for Python there is Py++; we don't have the equivalent of that for Perl.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2014-08-30 14:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (293 votes), past polls