[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tradeoffs with resources



	    I am interested in using resources but can't tell where the break-even
	    and big-win points are from the documentation.

	    (1) How much consing does the resource facility do (independent of the froms
		I supply) when an object is created?

	    >None (at least on an Ivory under 8.0).
Barmar's answer of "very little" was more accurate than mine of "none", since,
as others have pointed out, the vector of objects allocated may need to be
enlarged if enough objects are in use at once.

    Date: Fri, 21 Sep 90 11:26:19 EDT
    From: olson@juliet.ll.mit.edu
	    >Here's how I tested it:
	    >(defresource my-resource () :constructor (make-array 10))
	    >11 structure words consed in WORKING-STORAGE-AREA.
	    >The resource itself occupies 11 words.

    Thats not right, 11 words is simply the size of the array.

My choice of wording was poor.  I was using "resource" to mean the object
allocated, not the structure of type si:resource that allocates it.  Come to
think of it, there isn't any clear terminology, is there?  You used the term
"resource object" later in your message, as distinct from "resource", but
that's only a little less ambiguous.

On the subject of alternatives to resources, STACK-LET should be mentioned.
It's good for some applications, if you have fairly small, short-lived
objects, when you don't have to decide dynamically how many to create.  It
seems to work for lists, arrays, hash tables, and instances.

--Kanef