Article View: comp.lang.prolog
Article #911Re: Bogus! (was Re: Proof that Prolog can be faster than C)
From: Richard A. O'Keefe
Date: Thu, 14 Jun 1990 03:24
Date: Thu, 14 Jun 1990 03:24
37 lines
2593 bytes
2593 bytes
In article <1990Jun12.212525.25551@iwarp.intel.com>, merlyn@iwarp.intel.com (Randal Schwartz) writes:
> In article <36986@ucbvax.BERKELEY.EDU>, vanroy@pisces writes:
> | Benchmark Prolog C (no opt.) C (opt. 4)
> | tak(24,16,8) 1.2 2.1 1.6
> Bogus.
> The Prolog version most likely saves results from tak(a,b,c) so that
> they can do a quick lookup the next time around.
Now *that* claim is bogus. It was specifically stated that this was
a *Prolog* implementation, which means that it *mustn't* cache results.
(If van Roy had meant that something like extension tables was involved,
no doubt he would have said so.)
The explanation is much much simpler. Everything in Prolog involves
procedure calls, so a good Prolog implementation has had a _lot_ of
thought put into making procedure calls _really_ cheap. Procedure calls
are important in C, but not important enough for VAX implementations
to bypass the 'CALLS' instruction and use 'JSR'.
This particular benchmark result tells us precisely two things:
(1) _one_ Prolog system on that machine has cheaper procedure calls
than _one_ C compiler. Good work! But not very surprising given
that C compiler writers tend to worry more about other things.
(2) that particular Prolog system handles integer arithmetic better
than a lot of other Prolog systems.
It doesn't tell us how C and Prolog would compare on realistic applications,
and there the pertinent question tends to be how easy it is to handle a
good data structure. I've an example where I speeded a program up quite
substantially by translating from Fortran to Prolog, the speedup really
came from using a much better data structure, but it was much easier to
use that data structure in Prolog. With all due respect to Perl (The
TECO of the 90s) this is one respect where Perl 1.x was not as good as
it might have been (miles better than awk, though).
--
"A 7th class of programs, correct in every way, is believed to exist by a
few computer scientists. However, no example could be found to include here."
Technical Details
Message-ID:
<3250@goanna.cs.rmit.oz.au>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!samsung!munnari.oz.au!goanna!okReferences:
<36986@ucbvax.BERKELEY.EDU> <1990Jun12.212525.25551@iwarp.intel.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!samsung!munnari.oz.au!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.prolog Subject: Re: Bogus! (was Re: Proof that Prolog can be faster than C) Message-ID: <3250@goanna.cs.rmit.oz.au> Date: 14 Jun 90 03:24:15 GMT References: <36986@ucbvax.BERKELEY.EDU> <1990Jun12.212525.25551@iwarp.intel.com> Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 37