🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #4095

assert/record

#4095
From: John Milbury-Steen
Date: Thu, 14 Dec 1989 15:14
34 lines
1637 bytes
We have some applications with large amounts of data,
that must be modified a lot during run time.  Is
it more efficient to use "record" or "assert?"  

If, for example, you are storing the fact that
Fido is brown, is it better to say:
   record(fido, color(brown), _)
or to say:
   assert(fido(color(brown)))

Assume the program knows about 30 attributes of 5000 dogs.
(My applications are not really canine).


Are recommendations different for Arity Prolog and
Quintus?

I think asserting might be just as efficient, because
once you know the dog, you can find the attribute
quickly via first-argument indexing.  If you record,
the system has to look at attributes sequentially
until it finds the attribute you want.  This is
uninformed speculation.

As for "record" I'd wager that "recorda" is better than
"recordz" because it ensures that items recently changed
are at the top of the data structure (like a stack).

Reactions from Those Who Know?
-- 
|   John Milbury-Steen   (302)451-2698   jms@sun.acs.udel.edu |
|   Office of Academic Computing and Instructional Technology |
|   University of Delaware                    Newark DE 19716 |
|   "Intellectual awareness does me no good."                 |
Technical Details
Message-ID: <5929@sun.acs.udel.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!wuarchive!udel!udccvax1!sun.acs.udel.edu!jms

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!wuarchive!udel!udccvax1!sun.acs.udel.edu!jms
From: jms@sun.acs.udel.edu (John Milbury-Steen)
Newsgroups: comp.lang.prolog
Subject: assert/record
Message-ID: <5929@sun.acs.udel.edu>
Date: 14 Dec 89 15:14:00 GMT
Reply-To: jms@sun.acs.udel.edu (John Milbury-Steen)
Organization: University of Delaware
Lines: 34