Article View: comp.lang.prolog
Article #842Re: Why is bagof so slow?
From: Alain Callebaut
Date: Mon, 28 May 1990 08:12
Date: Mon, 28 May 1990 08:12
20 lines
1096 bytes
1096 bytes
In article <2556@randvax.UUCP> Sanjai Narain writes : > In the following program, there is one fact about f, namely f(1). > Running times of two queries, each run a thousand times, are compared: > > f(X). > bagof(X,f(X),S). > > The first takes about 25ms, whereas the second about 1200ms. Why a > 40-fold difference in speed? Are there ways to speed up computation > of sets? Timings are for Quintus Prolog on a SPARC station, running > UNIX, with 16mb of main memory. If you don't need the full flexibility of bagof, you could use findall instead : that's much faster. I did the same timings, on a SPARCstation 1, with 16 MB, for BIM_Prolog 2.5. The f(X) took 10ms, the bagof 330ms and a findall 150ms. Alain Callebaut
Technical Details
Message-ID:
<1974@kulcs.kulcs.uucp>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!ub4b!kulcs!alainShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcsun!ub4b!kulcs!alain From: alain@kulcs.uucp (Alain Callebaut) Newsgroups: comp.lang.prolog Subject: Re: Why is bagof so slow? Message-ID: <1974@kulcs.kulcs.uucp> Date: 28 May 90 08:12:13 GMT Reply-To: alain@kulcs.UUCP () Organization: Katholieke Universiteit Leuven, Dept. Computer Science Lines: 20