[squeak-dev] The Inbox: Collections-ct.995.mcz
Levente Uzonyi
leves at caesar.elte.hu
Sun Mar 13 21:41:48 UTC 2022
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!
More information about the Squeak-dev
mailing list
|