--- Steffen Schwigon <[EMAIL PROTECTED]> wrote:

> Now I'm not sure about its performance. I expect about 1 to 3
> requests
> per second at peak times and I don't know yet how long my prolog
> programm will take.
> 
> Does Language::Prolog::Yaswi start a new "pl" process for every
> query? 
> The README talks about threads, so maybe it already does something
> clever about this.

The reason threads are mentioned is because Perl and SWI-Prolog must
both have threads enabled or both NOT have threads enabled.  Threads
are not a requirement.  I'm not aware that SWI-Prolog does start
another process but I certainly wouldn't place a bet on that.

I would strongly recommend Devel::Profiler or something similar on your
code to find out where your true bottlenecks are.  If you do find out
your Prolog calls are slow, then you can spend the time tuning those
queries (of course, if it's just too many Prolog queries in too short
of  a time, tuning might not help).  On the other hand, if profiling
can get you significant gains in the Perl portion, then you may get a
win just by tuning Perl.  If you can't speed up the Prolog, trying to
replicate it's functionality in Perl may be difficult.  Of course,
there are tricks you can use to push much of the logic into a database
and making multiple calls from Perl.  That's probably slower but a good
RDBMS has optimizations that Prolog often doesn't so it's worth
exploring if you're stuck.

If you really have problems with Prolog, I would suggest issuing a
bunch of short Prolog queries and timing them and then issue some
long-running queries.  Time them both from Perl and directly in
SWI-Prolog as if you were running it there.  That can give you some
idea as to the performance impact from Perl.

Cheers,
Ovid

-- 
If this message is a response to a question on a mailing list, please send
follow up questions to the list.

Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/

Reply via email to