Elian - I specifically stated in a later paragraph that high-performance items should be written in C over Perl. (I make no statement about any other language in that sentence.)

My use of the word "ease" is in the sense of "ease of initial development". Perl is the rapid-prototyping language of choice for me and most people I know. Now, if I need greater performance (for some aspect of performance) after writing the first version(s) in Perl, I will evaluate to see if porting it (or some parts) to another language, such as C, is something I feel is warranted.

And, there are whole classes of problems for which neither C nor Perl is the best tool. For example, database queries. SQL is a much better language for querying normalized data than C or Perl. Hence, the reason why Pro*C exists and why we pass SQL to DBI instead of querying the tables in native Perl.

As for writing interpreters in one language vs. another ... I'm going to suspect that writing the parsing portion for an interpreter is easier to do in Perl than in C, simply for the string manipulation functions. Now, having that parser do its work within a reasonable amount of time (for some value of reasonable) ... that's where it becomes a high-performance item, and another language (such as C) could be considered.

There is also a lot more history writing a parser in C vs. Perl, so a number of the standard gotchas have been solved in C. Solutions in one language, especially ones that take advantage of extremely advanced language features, are generally not easily translatable to another language. So, one would have to rebuild all those standard solutions in Perl. (This, I suspect, is one of the reasons why more parsers are not written in languages other than C, even if there may be other reasons to do so.)

(Please note that I have never written anything more than a toy parser. It would definitely be something interesting to do.)

------
We are the carpenters and bricklayers of the Information Age.

The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

... strings and arrays will suffice. As they are easily available as native data types in any sane language, ... - blokhead, speaking on evolutionary algorithms

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.


In reply to Re: Re: Re: Re: C vs. Perl by dragonchild
in thread C vs. Perl by podian

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.