[squeak-dev] The Inbox: Collections-ct.995.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Mon Mar 14 12:58:00 UTC 2022


Hi Levente --

> expects that the first two assignments happen atomically

We should add this to the comment.

Best,
Marcel
Am 13.03.2022 22:42:03 schrieb Levente Uzonyi <leves at caesar.elte.hu>:
Hi Christoph,

#condenseNewSymbols expects that the first two assignments happen
atomically. Using #ifEmpty: and creating a block will introduce suspension
points, hence atomicity will not be ensured.

Despite its name, the method also compacts SymbolTable as it is stated
in the method comment. That would not be true with your change.

On my machine it takes 40-60ms for the original method to finish. Is that
too slow? If yes, it can be sped up but a different method needs to
be changed.


Levente

On Sat, 12 Mar 2022, commits at source.squeak.org wrote:

> A new version of Collections was added to project The Inbox:
> http://source.squeak.org/inbox/Collections-ct.995.mcz
>
> ==================== Summary ====================
>
> Name: Collections-ct.995
> Author: ct
> Time: 12 March 2022, 2:46:24.947632 am
> UUID: 9c697903-e2ac-2244-85cb-5234b3a3c9ca
> Ancestors: Collections-mt.994
>
> Accelerates Symbol condenseNewSymbols if there are no new symbols.
>
> =============== Diff against Collections-mt.994 ===============
>
> Item was changed:
> ----- Method: Symbol class>>condenseNewSymbols (in category 'private') -----
> condenseNewSymbols
> "Move all symbols from NewSymbols to SymbolTable, and compact SymbolTable."
>
> | originalNewSymbols originalSymbolTable newNewSymbols newSymbolTable |
> + originalNewSymbols := NewSymbols ifEmpty: [^ self].
> - originalNewSymbols := NewSymbols.
> originalSymbolTable := SymbolTable.
> newNewSymbols := WeakSet new.
> newSymbolTable := originalSymbolTable copy
> addAll: originalNewSymbols;
> compact;
> yourself.
> originalNewSymbols == NewSymbols ifFalse: [
> "Some other process has modified the symbols. Try again."
> ^self condenseNewSymbols ].
> NewSymbols := newNewSymbols.
> SymbolTable := newSymbolTable!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220314/0a27e8ef/attachment.html>


More information about the Squeak-dev mailing list