[3900] in java-interest
Re: Comments about AWT, etc.
daemon@ATHENA.MIT.EDU (Gary Aitken)
Fri Dec 1 02:59:38 1995
Date: Thu, 30 Nov 1995 23:47:22 -0700
From: garya@village.org (Gary Aitken)
To: donpark@telewise.com (Don Park)
Cc: java-interest@java.sun.com
In-Reply-To: <199512010419.UAA25713@gw.quake.net>
>I have also used 'object-pocket' concept with great success in many of my
>projects. Like you said, 4 bytes are all you need to add 'pockets' to
>objects in which arbituary data and references can be stored. Rather than
>dealing with hashvalue explicitly, I typically rely on string atoms and a
>smart storge interface which adopts appropriate implementation strategy
>depending on the efficiency/cost factor.
The only problem with hiding the hashvalue interface is that it removes a
significant amount of possible optimization. If the caller uses the same tags
over and over, the caller can do the hash once, and the lookup mechanism only
has to deal with the hash value. Otherwise, on each call the lookup mechanism
has to do a hash. For millions of calls, I have seen this add up to over 10%
of the total time spent in an app.
> Most objects' will have only a few
>'stuff' in their pocket so a simple list will do. For 'bag-lady' objects,
>more elaborate scheme is used. The smart interface decides at runtime to
>switch from simple scheme to more complex ones when certain thresholds are
>reached.
I suppose if one wanted to do this *right*, the interface would allow an app to
supply the class which implements the attribute storage/retrieval mechanism,
plus a means of changing it dynamically. This would be pretty simple to add;
I'd even sign up for that part too :-) I guess that says I would really really
really really really really really really really like to see this part of the
base Object class, and I think (if past experience is any gauge) a lot of
people would thank Sun for including it if they did it.
Gary Aitken garya@village.org
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com