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

Re (tilly) 1: How good is Perl for AI?

by tilly (Archbishop)
on Nov 06, 2001 at 22:07 UTC ( [id://123643]=note: print w/replies, xml ) Need Help??


in reply to How good is Perl for AI?

First of all, it shouldn't matter what my gender is. It is no secret, if you browse my nodes long enough you can find a fuller name than just tilly, and then it should be dead obvious what my gender is. But if you wanted to know, I would strongly prefer that you asked me directly rather than posting the question to the winds.

As for the actual question, well there are a lot of things called "AI". For some of them Perl is a good fit. For others it is not. When Perl is a fit, it is a fit for the same reason that it is good for other things. You can do complex stuff easily, you have a lot of high-level constructs, you have useful stuff on CPAN. I am sure everyone here can find other things to put on the list of good things about Perl.

But Perl also has the following well-known disadvantages:

  1. Excessive memory use. If your program winds up working with and correlating a lot of data, Perl may fall over before you expect it.
  2. Poor performance. Many tasks that we call AI involve a lot of computation, backtracking, etc. Perl is good for a scripting language, but is is no speed demon. You do not, for instance, find good ray-tracers or chess programs written in Perl, for good reason.
  3. No true garbage collection. People argue back and forth whether or not it is better in general to have reference counting or true garbage collecting. But there is no question that if you want to manage recursive data structures with self-references, then it is much more convenient to have true garbage collection. The WeakRef module helps, but not enough if you are doing something complex.
Now when you came by in chatter, your problem was that you were running out of RAM on your cluster of rather nice machines. Now after discussion, some of that didn't seem to really be Perl's fault. A lot of it appeared to be the recopying of data inside of Parse::RecDescent. (I have heard multiple times now that TheDamian is working on a replacement that uses pos manipulation rather than recopying. That likely would solve your problem.)

But still when you are bottlenecking on known issues in the language, that should make you wonder at the suitability of the tool. So in this instance you would try to get the memory usage down and performance up. If you cannot get them within acceptable parameters, switching to Lisp, Dylan, Haskell, or OCaml would be perfectly reasonable.

But if it works for you, then it works for you.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://123643]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-18 07:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found