Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!Germany.EU.net!EU.net!nova.puug.pt!ciup2.ncc.up.pt!news.ci.ua.pt!ia2
From: ia2@ci.ua.pt (login IA2)
Subject: Re: Efficiency of assertion and retraction
Sender: usenet@news.ci.ua.pt (News Administrator)
Message-ID: <D0147E.5C3@news.ci.ua.pt>
Date: Tue, 29 Nov 1994 12:33:09 GMT
References: <1994Nov26.005920.26932@jarvis.cs.toronto.edu>
Nntp-Posting-Host: estai.cet.pt
Organization: Universidade de Aveiro, Portugal
X-Newsreader: TIN [version 1.1 PL8]
Lines: 31

Samuel Yet K Hung (goku@csri.toronto.edu) wrote:
: I have tried to execte the following program in SCIStus Prolog 0.6 #18.

: test1(0).
: test1(N) :- N>0, N1 is N-1, assert(a(N)), test1(N1).

: test2(0).
: test2(N) :- N>0, N1 is N-1, retract(a(N)), test2(N1).

: test3(0).
: test3(N) :- N>0, N1 is N-1, assert(a(N)), retract(a(N)), test3(N1).

: When I asked test1(10000), it took around 2 second to insert the 10000 tuples.
: However, when I used test2(10000) to retract all the tuples, it took over
: 15 minutes. 

I've tried this using LPA Prolog for Windows v2.6.

test1 took around 2 seconds to insert the 10000 tuples, and test2 took around
3 seconds to retract all the tuples.

My surprise is with test3, which took about the same 3 seconds than test2.

--
        ______________________________________________________________
       / Mario Moreira         Centro de Estudos de Telecomunicacoes /
      / mesmam@di.uminho.pt                        Telecom Portugal //
     / moreira@smtpdos.cet.pt                    Aveiro - Portugal //
    / http://alfa.di.uminho.pt/~mesmam/     Universidade do Minho //
   /_____________________________________________________________//
     /////////////////////////////////////////////////////////////
