<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p><span style="font-size: 12pt;">Hi Levente,</span><br>
</p>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<p><br>
</p>
<p>thanks for the feedback! The atomicity is a good point, I will document this in a comment.</p>
<p><br>
</p>
<p>> <span style="font-size:12pt">On my machine it takes 40-60ms for the original method to finish. Is that </span><span style="font-size:12pt">too slow?</span></p>
<p><span style="font-size:12pt"><br>
</span></p>
<p><span style="font-size:12pt">In the majority of situations, probably not. :-)</span></p>
<p><span style="font-size:12pt">My use case was a bit special: I am running large code sections in the simulator, which includes sends to Symbol class cleanUp: or Symbol class shutDown:. Inside the simulator, #condenseNewSymbols is significantly more expensive.
 In this context, I can run "Symbol condenseNewSymbols" right before starting the simulator, but this only speeds up the simulation if any follow-up send to #cleanUp: or #shutDown: will not condense/compress the tables again.</span></p>
<p><span style="font-size:12pt"><br>
</span></p>
<p>I have just uploaded <span>Collections-ct.996 to the inbox, what do you think about it? :-)</span></p>
<p><span style="font-size:12pt"></span></p>
<p><span style="font-size:12pt"><br>
</span></p>
<p><span style="font-size:12pt">Best,</span></p>
<p><span style="font-size:12pt">Christoph</span></p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Levente Uzonyi <leves@caesar.elte.hu><br>
<b>Gesendet:</b> Sonntag, 13. März 2022 22:41:48<br>
<b>An:</b> squeak-dev@lists.squeakfoundation.org<br>
<b>Betreff:</b> Re: [squeak-dev] The Inbox: Collections-ct.995.mcz</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt">
<div class="PlainText">Hi Christoph,<br>
<br>
#condenseNewSymbols expects that the first two assignments happen <br>
atomically. Using #ifEmpty: and creating a block will introduce suspension <br>
points, hence atomicity will not be ensured.<br>
<br>
Despite its name, the method also compacts SymbolTable as it is stated<br>
in the method comment. That would not be true with your change.<br>
<br>
On my machine it takes 40-60ms for the original method to finish. Is that <br>
too slow? If yes, it can be sped up but a different method needs to <br>
be changed.<br>
<br>
<br>
Levente<br>
<br>
On Sat, 12 Mar 2022, commits@source.squeak.org wrote:<br>
<br>
> A new version of Collections was added to project The Inbox:<br>
> <a href="http://source.squeak.org/inbox/Collections-ct.995.mcz" id="LPlnk874497" previewremoved="true">
http://source.squeak.org/inbox/Collections-ct.995.mcz</a><br>
><br>
> ==================== Summary ====================<br>
><br>
> Name: Collections-ct.995<br>
> Author: ct<br>
> Time: 12 March 2022, 2:46:24.947632 am<br>
> UUID: 9c697903-e2ac-2244-85cb-5234b3a3c9ca<br>
> Ancestors: Collections-mt.994<br>
><br>
> Accelerates Symbol condenseNewSymbols if there are no new symbols.<br>
><br>
> =============== Diff against Collections-mt.994 ===============<br>
><br>
> Item was changed:<br>
>  ----- Method: Symbol class>>condenseNewSymbols (in category 'private') -----<br>
>  condenseNewSymbols<br>
>        "Move all symbols from NewSymbols to SymbolTable, and compact SymbolTable."<br>
><br>
>        | originalNewSymbols originalSymbolTable newNewSymbols newSymbolTable |<br>
> +      originalNewSymbols := NewSymbols ifEmpty: [^ self].<br>
> -      originalNewSymbols := NewSymbols.<br>
>        originalSymbolTable := SymbolTable.<br>
>        newNewSymbols := WeakSet new.<br>
>        newSymbolTable := originalSymbolTable copy<br>
>                addAll: originalNewSymbols;<br>
>                compact;<br>
>                yourself.<br>
>        originalNewSymbols == NewSymbols ifFalse: [<br>
>                "Some other process has modified the symbols. Try again."<br>
>                ^self condenseNewSymbols ].<br>
>        NewSymbols := newNewSymbols.<br>
>        SymbolTable := newSymbolTable!<br>
<br>
</div>
</span></font></div>
</body>
</html>