Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Perl's rank among languages

by elusion (Curate)
on Jan 02, 2002 at 21:25 UTC ( #135721=perlmeditation: print w/ replies, xml ) Need Help??

My fellow monks,

There I was, looking at the results of The Great Language Shootout, when I realized Perl is only ranked 14th (of 30). Having looked at some of the source on the page, I have an inkling that much of it could be greatly improved. The author requests improved solutions, so I thought it might be nice for some of the monks around the monastery to drop in. Maybe improved versions should be posted under this thread to start a golf-like competition, bearing in mind the areas in which the score is determined (CPU, memory, and # of lines).

elusion : http://matt.diephouse.com

Comment on Perl's rank among languages
(ar0n) Re: Perl's rank among languages
by ar0n (Priest) on Jan 02, 2002 at 21:40 UTC

      Use the best tool for the job.

      The job in question is improving some rather public Perl code, not frothing-at-the-mouth language advocacy.

      Update: I do appreciate the sentiment wrt. actual unreasoning-advocacy, though.

      --
      :wq
        Ah, that's what I get for not reading the entire post. My language-advocacy-alarm went off a bit too soon. I apologize.

        [ ar0n -- want job (boston) ]

They only rated their Perl skill
by arhuman (Vicar) on Jan 02, 2002 at 22:30 UTC
    Alas, on the frontpage (in red) you can read :

    Hi, the shootout is an unfinished project. I've decided to discontinue updates to it for now while I work on some other things. Thanks for everyone's help.

    Which is really a sad thing as their perl code is crippled, with unnecessary code :
    (lines number is part of their scoring system)
    • useless variables initialization (my %hash=())
    • useless buffering
      while (read(STDIN, $_, 4095)) { $_ .= <STDIN>; ... }
      instead of
      while(<STDIN>) { ... }
    • some examples seem really partial to me :
      echo `wc` is allowed for bash, whereas the Perl solution don't use the one line solution (print `wc`;)
    • ad nauseaum...

    "Only Bad Coders Code Badly In Perl" (OBC2BIP)
Re: Perl's rank among languages
by jmcnamara (Monsignor) on Jan 02, 2002 at 22:54 UTC

    The Perl code that has been submitted doesn't look great. Here is the Perl code for Sum a Column of Integers:
    #!/usr/local/bin/perl use integer; shift; while (<>) { $tot += $_ } print "$tot\n";
    Since the number of lines is a judging criterion these 4 lines could have been written as follows:
    #!/usr/bin/perl -pl $tot += $_ }{ $_ =+ $tot
    Also, using integer is unnecessary and is bound to slow the code down.

    However, as arhuman points out, it looks like the contest is on hold for now.

    --
    John.

      Also, using integer is unnecessary and is bound to slow the code down.

      Actually, using integer when you just need integer arithmetic speeds the code up slightly (about 30% in my benchmark). The real question in this "shootout" is if its worth the extra line of code and how CPU and lines of code are weighted in the score :-)

Re: Perl's rank among languages
by scott (Chaplain) on Jan 02, 2002 at 23:32 UTC

    Note also that the main page says Disclaimer No. 4: Please read the pages on Methodology, the FAQ, and my Conclusion before you flame.

    In particular, the Methodology section makes it clear that some tests are deliberately written non-idiomatically so that they can test common features of all the languages.

      In particular, the Methodology section makes it clear that some tests are deliberately written non-idiomatically so that they can test common features of all the languages.

      This notion of non-idiomatic should be clearly defined, to my mind,
      it's (at best) unfair, beccause it gives a serious advantage to the ones considered as 'idiomatic' (C?).
      Moreover why compare languages if you can't use their own strengths ?

      Anyway I don't think that adding useless instruction in Perl make it 'non-idiomatic Perl'.

      Furthermore look at other language examples I DO find that some of them use language specific idioms.
      (some haskell and ruby code for example)

      UPDATE :

      From the methodology text :

      Since functional languages have such a different mode of expression, I allow them more leeway

      In some cases I'm not really measuring the speed of a language, but how good of a programmer I am in that given language.

      "Only Bad Coders Code Badly In Perl" (OBC2BIP)

        This notion of non-idiomatic should be clearly defined, to my mind ...

        True. Many moons ago I actually read a lot of the site and I seem to recall that certain tests were required to be written as close as possible to some predetermined form. If my mind isn't fibbing, that could easily require variable initialization, etc.

        To continue the tete-a-tete of qouting:

        Disclaimer No. 1: I'm just a beginner in many of these languages, so if you can help me improve any of the solutions, please drop me an email. Thanks.

        Disclaimer No. 2: These pages are provided for novelty purposes only. Any other use voids the manufacturer's warranty. Do not mix with alchohol. Some contents may consist of recycled materials.

        By the way, the word Great in the title refers to quantity, not quality

        I'm doing it so that I can learn about new languages, compare them in various (possibly meaningless) ways, and most importantly, have some fun.

      The Methodology reveals a lot.

      Measuring CPU
      ...Each test is executed as a sub-process of a Perl script that...

      Measuring Lines of Code
      ...For each test language, I use a (Perl) script to...

      How Tests Are Graphed
      ...For plotting, I wrote a Perl script that...

      Now where's that usefulness metric?

      YuckFoo

Re: Perl's rank among languages
by YuckFoo (Abbot) on Jan 03, 2002 at 00:01 UTC
    On the 'scorecard' page, weights can be assigned to each of the measurements, CPU, Memory, and LOC. Perl ranked 14 when only CPU usage is considered. If you enter a weight of '1' for each measurement to consider all three equally, Perl ranks 8th, 4th if you don't count languages I've never heard of.
Re: Perl's rank among languages
by petral (Curate) on Jan 03, 2002 at 00:28 UTC
    Notice that if you select only the string, array, hash and io processing (about 1/2 the tests) and give equal weight to cpu usage and lines of code, perl comes in first.  Which, as has been mentioned, says something about the right tool for the job.

      p
Re: {DUPE} Perl's rank among languages
by NodeReaper (Curate) on Jan 03, 2002 at 00:28 UTC

    Reason: (petral) Ack, crossed my edit with my submit or something!

    For more information on this node visit: this

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2014-08-23 10:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (173 votes), past polls