[comp.lang.prolog] argument 2 and 3 of append/3

bimbart@kulcs.UUCP (Bart Demoen) (10/15/87)

Reply to the News of Lars-Henrik Eriksson of 5 Oct 87 10:41:33 GMT

We read with delight on News the - for us - old news that switching the
position of the second and third argument of append/3 results in such a
dramatic speed loss for a well known "high-powered commercial Prolog system"
(you have 2 guesses and it is not BIMprolog ...)
We at BIM learned this by looking at the code 'generated' for the WAM
instructions in this implementation ... we could not believe our eyes, and we
estimated (we could not execute it !) the effect of this quirk around 15% and it
turns out to be 35%, wonderful ! What people do to reach 20Klips for nrev on
a SUN2 (it is 2.5 years ago already) ... one would at least expect them to
generalise this trick in later releases, but not even that !

Test yourself with the following multiple choice:

   the speed loss is due to:

	1. shortage of hardware registers
	2. special treatment of the sequence
			UNIFY_XVAL  4
			UNIFY_XVAR  3

We give you one more hint: this implementation uses just enough hardware
registers to store all temporary registers of the second definition of append/3

Bart Demoen  bimbart@kulcs  bart@sunbim
Andre Marien andre@sunbim   bimandre@kulcs