Date: Mon, 18 Nov 96 11:19:01 MST From: bartlett@Exabyte.COM (Peter Bartlett) To: p.richards@elsevier.co.uk Cc: chat@FreeBSD.org Subject: Re: Who needs Perl? (Was: cvs commit: src/share/doc/handbook ...) Message-ID: <9611181819.AA04923@fern.Exabyte.COM>
next in thread | raw e-mail | index | archive | help
> bartlett@Exabyte.COM (Peter Bartlett) writes: > > > In my experience this is not necessarily the case. I have in the past > > compared performance of programs written separately in Perl and C. > > These were written to perform a complex engineering task involving lots of > > text manipulation, array operations, integer math, etc. The Perl program > > (several thousand lines) won hands down. > > > > The reason? Perl's "associative array" data type. Very rarely do C > > programmers take the time to implement hash tables for the various data > > types they wish to do searches on. Usually the result is long searches > > of linked lists, perhaps sorted lists for some performance improvement. > > > > With Perl the hash tables are built in, resulting in far better search > > times. > > This is a pretty silly point of view. 'C' is always going to be faster > than perl for correctly implemented solutions. Stating the Perl is > faster than badly written 'C' isn't very fair. > > -- > Paul Richards. Originative Solutions Ltd. (Netcraft Ltd. contractor) > Elsevier Science TIS online journal project. > Email: p.richards@elsevier.co.uk > Phone: 0370 462071 (Mobile), +44 (0)1865 843155 > No, it's a realistic point of view. In practice C programmers often do not take the time to implement the "correct" solution. Given the choice between developing and testing a hash function for a complex data class and simply implementing a linked list, the latter is often chosen due to time constraints, particularly if the programmer feels that the data set in question is unlikely to be large enough to merit the additional storage requirements of hashing. What's really silly is assuming that the "correct" solution is always chosen anywhere outside of academia. In the real world the time alotted to complete a given task is often much less than the time required to implement an optimal solution. It doesn't mean the programmer in question is unskilled. In fact the kind of programmers who can intuitively make these kind of tradeoffs (rather than insisting on a too-late, "correct" implementation) are generally far more valuable to their employers. My argument was that Perl can be a valuable tool for producing better solutions more quickly than with C for some applications. I wasn't tying to be fair, just realistic. Pete
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9611181819.AA04923>