[squeak-dev] [Performance] #printString and Array ... (Example: LRUCache)

Levente Uzonyi leves at elte.hu
Mon Jan 19 19:50:09 UTC 2015


It's because I wanted the changes to be minimal, so I kept the use of 
Arrays in LRUCache. 
The head variable points to a circular array structure (a circular 
doubly-linked list), so the only thing that stops infinite recursion is 
the 50k character limit in #printString.
As Bert suggested, this recursion in printing can be avoided by using a 
custom class for the list nodes.

Levente

On Mon, 19 Jan 2015, Marcel Taeumel wrote:

> Hi, there!
>
> c := LRUCache someInstance.
> (c instVarNamed: #map) size.  "47"
> [(c instVarNamed: #head) printString size] timeToRun. "1825"
>
> If this cache grows, #printString gets very slow.
>
> c := LRUCache allInstances first.
> (c instVarNamed: #map) size. "4952"
> [(c instVarNamed: #head) printString size] timeToRun. "Well..."
>
> Any ideas how to fix that?
>
> Best,
> Marcel
>
>
>
> --
> View this message in context: http://forum.world.st/Performance-printString-and-Array-Example-LRUCache-tp4800322.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>
>


More information about the Squeak-dev mailing list