Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Re: Specific Examples? - Re: A Macro System for Perl?

by shotgunefx (Parson)
on May 03, 2002 at 20:28 UTC ( #163894=note: print w/replies, xml ) Need Help??

in reply to Re: Specific Examples? - Re: A Macro System for Perl?
in thread A Macro System for Perl?

Keep in mind though Lisp is somewhat slow to begin with. I'd wager that mundane Perl coding would still beat profiled Lisp.


"To be civilized is to deny one's nature."
  • Comment on Re: Re: Specific Examples? - Re: A Macro System for Perl?

Replies are listed 'Best First'.
Re: Re: Re: Specific Examples? - Re: A Macro System for Perl?
by Elian (Parson) on May 03, 2002 at 20:39 UTC
    I wouldn't bet that. A good compiled lisp, and there are a number of them, will beat the pants off of perl for many things. (Regular expressions being a notable exception)
      To be honest, my experience with Lisp is limited. The view I had of Lisp being slow was due to
      1. Working with a platform that was implemented in Lisp by pg that was slow and memory intensive compared to other languages.
      2. A discussion between Paul Graham and Trevor Blackwell where they benchmarked some simple and common operations using C, Perl and Lisp.

      (I'm trying to dig it up now.) If I remember correctly, ANSI Clisp had to perform around 400+ operations to print a single character. Don't quote me on that though. I'll try and find the doc.


      "To be civilized is to deny one's nature."
        Printing's a rather significant piece of work, though--take a look at the hoops perl potentially has to jump through to do something like "print $foo". ('Specially if $foo is overloaded or tied)

        Anyway, while Lisp is rather difficult to optimize in some ways, it's not at all tough to compile. I think you'll find that, for those tasks which fit a Lisp mindset well, Lisp will wipe the floor with perl. If Lisp is running interpreted, then Perl's likely to win for some stuff, but never underestimate the power of compilation...

        If you are specifically referring to the CLISP implementation of Lisp (which isn't unlikely, as it's the one that Graham used for his famous Yahoo stores project), then it's important to note that (with a few exceptions like bignum arithmetic) it's a pretty slow Lisp. It'd be more interesting to see how something like ACL or Lispworks did.

Re: Re: Re: Specific Examples? - Re: A Macro System for Perl?
by hding (Chaplain) on May 04, 2002 at 12:45 UTC

    Hello. One of the Monastery's resident Common Lisp users here. I'd take that wager in a second. With the exception of certain things that Perl is explicitly optimized for (like regexes, string processing and such) I'd expect a quality Lisp (e.g. Lispworks, Allegro, CMUCL) to do much better. For example, I have considerable code doing numerical computations in Lisp, and it's typically not even worth rewriting it in (for example) C to attempt to get a speed improvement.

Re: Re: Re: Specific Examples? - Re: A Macro System for Perl?
by samtregar (Abbot) on May 03, 2002 at 23:13 UTC
    Now why would you just assume that? There are some really fantastic optimizing compilers for Lisp out there, not to mention veteran Lisp hackers with 20-odd years of experience making fast Lisp code...

    That's like saying that mundane C will beat profiled Perl, which is just as false.


      As I had noted in my post to Elian, I got the impression (mistaken or not) working with a platform that was written in Lisp written by Paul Graham and on some notes I've seen back and forth between him and Trevor Blackwell. I figured since Paul has for all intensive purposes wrote the book on Lisp, it is pretty optimized.

      Now the benches that I saw were mainly IO based and it was a lot slower than Perl which was slower than C which was slower then ASM.

      I could certainly be wrong but Lisp seems to bring with it a lot of inherent weight. Again, this is in my very limited experience with it. I don't doubt that Lisp is better suited for certain tasks. In fact my coding style has taken on a more Lisp-ish style in the past 6 months. (Though I would take Perl over Lisp anyday.)


      "To be civilized is to deny one's nature."
        Lisp is actually really light weight in most things, though having to support continuations (if you're using a dialect that has them) adds some overhead. It's not quite Forth-ish in its lightness, but it's not that far off.

        Part of Lisp's sluggishness comes from its very nature--it's really awkward to do a lot of things in Lisp. It just doesn't lend itself well to many problems. (For those you apparently need to use Scheme, which rumor has it will end world hunger, bring about world peace, and aid in the development of a really good tasting diet soda...)

        It's hard to say without knowing the specific benchmarks (and the code). It's certainly easy to do IO (in particular) slowly in Lisp. If one's Lisp has decently optimized read-sequence and write-sequence functions, it's also possible to do it pretty darn fast. One does need to know something about the various functions available to get the best results (e.g. format is incredibly powerful and convenient, but slow. If speed is of the essence, some other output method is called for. And so on.)

        I advise against putting too much weight on Graham's opinions. While he's certainly well respected, just as anyone he has his own predelictions and preferences which are entirely personal. For example, one who reads his two books may come out of them with the impression that loop is a bad thing, whereas in the general Common Lisp community, opinions are quite divided on the matter, with extremely well respected people on both sides of the issue. (And actually, ironically enough given that he wrote a book about it, Graham doesn't really seem to like Common Lisp that much at all.)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2018-06-22 23:19 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (124 votes). Check out past polls.