[Seaside-dev] Issue 312 in seaside: WALeastRecentlyUsedExpiryPolicy uses non-portable approach to increasing counter

codesite-noreply at google.com codesite-noreply at google.com
Tue Jan 27 23:49:06 UTC 2009


Status: Accepted
Owner: WeybridgeWay
Labels: Type-Portability Priority-Medium Version-Seaside2.9

New issue 312 by WeybridgeWay: WALeastRecentlyUsedExpiryPolicy uses  
non-portable approach to increasing counter
http://code.google.com/p/seaside/issues/detail?id=312

WALeastRecentlyUsedExpiryPolicy>>#'storing:key:' sends #'associationsDo:'  
that relies on the
internal implementation of whatever class is returned by (WAPlatform current
reducedConflictDictionary). Specifically, some Dictionary subclasses do not  
store Associations so
the #'associationsDo:' method creates a new Association to be passed to the  
block. Modifications to
the new Association do not change the value in the Dictionary (causing a  
test failure in GemStone).

Currently we have the following:

	ageTable associationsDo: [ :assoc | assoc value: assoc value + 1 ].

A portable implementation is as follows:

	ageTable keys do: [:each | ageTable at: each put: (ageTable at: each) + 1].

While the above works, it involves several dictionary lookups. A slightly  
more elaborate change
would be to store a container (e.g., an Association or an Array with one  
element), and then iterate
over the dictionary as follows:

	ageTable do: [:each | each at: 1 put: (each at: 1) + 1].

This should keep good performance (at the cost of a few more objects) and  
would require changes
to only a few more methods. Unless there is some objection, I'll put in  
that change tomorrow.

--James Foster

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings


More information about the seaside-dev mailing list