Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re^4: Perl vs C

by assemble (Friar)
on Mar 16, 2009 at 13:03 UTC ( #750886=note: print w/replies, xml ) Need Help??

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

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.

Replies are listed 'Best First'.
Re^5: Perl vs C
by chromatic (Archbishop) on Mar 16, 2009 at 18:08 UTC

    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.


      Most of my work is binary data crunching, and that's not exactly Perl's strongest suit. Perhaps if I was doing a large amount of work with text processing I would have noticed the performance increase.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://750886]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2018-01-20 01:19 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (226 votes). Check out past polls.