in reply to Re^2: Perl vs C
in thread Perl vs C
According to Code Complete 2, a number of studies have shown that, to a good approximation, the amount of code written per day in a programming language is independent of how high level that programming language is. Therefore you can estimate the productivity of people working in that language from the efficiency of saying things in that language. With that in mind he produces a chart of, based on real world code bases, the approximate relative number of statements needed in different languages to say the same thing.
By his figures, Perl is 6 times as efficient to say things in as C, which is within the 5-10x estimate that Marshall gave. Incidentally by his figures, Java is 2.5x as efficient as C, which would make Perl over twice as efficient to code in as Java.
About linked lists, one of the most common use cases for linked lists in C is that someone wants a queue or a stack which can grow arbitrarily without having to know the size first. For that use case, Perl arrays are a great replacement. For the case where you wish to insert or delete in the middle of an array, it is true that a linked list written in Perl scales better than using splice. But the overhead of Perl is so much that if your arrays only have hundreds of elements in it, the simple splice solution is more efficient than writing a linked list. (There is even more overhead if you want to keep your double-linked lists from leaking memory.)
So while Perl arrays are theoretically not replacements for linked lists, for a great many practical purposes they are.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Perl vs C
by halfcountplus (Hermit) on Mar 15, 2009 at 05:08 UTC | |
by GrandFather (Saint) on Mar 15, 2009 at 07:13 UTC | |
by JavaFan (Canon) on Mar 15, 2009 at 11:36 UTC | |
by GrandFather (Saint) on Mar 15, 2009 at 19:17 UTC | |
by tilly (Archbishop) on Mar 15, 2009 at 16:21 UTC |