The Inbox: Tools-jr.930.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Tools-jr.930.mcz

commits-2
A new version of Tools was added to project The Inbox:
http://source.squeak.org/inbox/Tools-jr.930.mcz

==================== Summary ====================

Name: Tools-jr.930
Author: jr
Time: 8 February 2020, 10:41:43.910741 am
UUID: c64775b8-3ea3-9d41-81a3-8eea293ee438
Ancestors: Tools-jr.929, Tools-mt.929

Speed up removing of messages from MessageTrace.

In an existing MessageTrace, try "senders of at:put:", then remove them again with "remove from this browser (d)". Took several seconds before, finishes in an instant now.

Replaces autoSelectStrings and messageSelections with new OrderedCollections. The other method deleteFromMessageList: removes one element from the existing collections instead.

=============== Diff against Tools-jr.929 ===============

Item was added:
+ ----- Method: MessageSet>>deleteAllFromMessageList: (in category 'message functions') -----
+ deleteAllFromMessageList: aCollection
+ "Delete the given messages from the receiver's message list"
+ | currIdx |
+ currIdx := self messageListIndex.
+ messageList := messageList copyWithoutAll: aCollection.
+ messageList ifNotEmpty: [self messageListIndex: {currIdx. messageList size.} min]!

Item was added:
+ ----- Method: MessageTrace>>deleteAllFromMessageList: (in category 'building') -----
+ deleteAllFromMessageList: aCollection
+ "Delete the given messages from the receiver's message list"
+
+ | newAutoSelectStrings newMessageSelections newSize set |
+ newSize := self messageList size - aCollection size.
+ newAutoSelectStrings := OrderedCollection new: newSize.
+ newMessageSelections := OrderedCollection new: newSize.
+ set := aCollection asSet.
+ self messageList withIndexDo: [:each :index |
+ (set includes: each) ifFalse:
+ [newAutoSelectStrings add: (autoSelectStrings at: index).
+ newMessageSelections add: (messageSelections at: index)]].
+ super deleteAllFromMessageList: aCollection.
+ autoSelectStrings := newAutoSelectStrings.
+ messageSelections := newMessageSelections.
+ anchorIndex ifNotNil:
+ [ anchorIndex := anchorIndex min: messageList size ]!

Item was changed:
  ----- Method: MessageTrace>>removeMessageFromBrowser (in category 'building') -----
  removeMessageFromBrowser
  | indexToSelect |
  "Try to keep the same selection index."
  indexToSelect := (messageSelections indexOf: true) max: 1.
+ self deleteAllFromMessageList: self selectedMessages.
- self selectedMessages do: [ :eachMethodReference | self deleteFromMessageList: eachMethodReference ].
  self deselectAll.
  messageSelections ifNotEmpty:
  [ messageSelections
  at: (indexToSelect min: messageSelections size)  "safety"
  put: true ].
  anchorIndex := indexToSelect min: messageSelections size.
  self
  messageListIndex: anchorIndex ;
  reformulateList!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Tools-jr.930.mcz

Christoph Thiede

+1 :-)


Some really minor critic that probably no one else cares:


+        | currIdx |


I don't think Smalltalk code needs such counterintuitive abbreviations.

{currIdx. messageList size.} min

could be written as: (currIdx min: messageList size).

But it's rather a question of taste, it's nice to have some people caring about our wonderful Squeak tools :-)

Best,
Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von [hidden email] <[hidden email]>
Gesendet: Samstag, 8. Februar 2020 10:41:33
An: [hidden email]
Betreff: [squeak-dev] The Inbox: Tools-jr.930.mcz
 
A new version of Tools was added to project The Inbox:
http://source.squeak.org/inbox/Tools-jr.930.mcz

==================== Summary ====================

Name: Tools-jr.930
Author: jr
Time: 8 February 2020, 10:41:43.910741 am
UUID: c64775b8-3ea3-9d41-81a3-8eea293ee438
Ancestors: Tools-jr.929, Tools-mt.929

Speed up removing of messages from MessageTrace.

In an existing MessageTrace, try "senders of at:put:", then remove them again with "remove from this browser (d)". Took several seconds before, finishes in an instant now.

Replaces autoSelectStrings and messageSelections with new OrderedCollections. The other method deleteFromMessageList: removes one element from the existing collections instead.

=============== Diff against Tools-jr.929 ===============

Item was added:
+ ----- Method: MessageSet>>deleteAllFromMessageList: (in category 'message functions') -----
+ deleteAllFromMessageList: aCollection
+        "Delete the given messages from the receiver's message list"
+        | currIdx |
+        currIdx := self messageListIndex.
+        messageList := messageList copyWithoutAll: aCollection.
+        messageList ifNotEmpty: [self messageListIndex: {currIdx. messageList size.} min]!

Item was added:
+ ----- Method: MessageTrace>>deleteAllFromMessageList: (in category 'building') -----
+ deleteAllFromMessageList: aCollection
+        "Delete the given messages from the receiver's message list"
+
+        | newAutoSelectStrings newMessageSelections newSize set |
+        newSize := self messageList size - aCollection size.
+        newAutoSelectStrings := OrderedCollection new: newSize.
+        newMessageSelections := OrderedCollection new: newSize.
+        set := aCollection asSet.
+        self messageList withIndexDo: [:each :index |
+                (set includes: each) ifFalse:
+                        [newAutoSelectStrings add: (autoSelectStrings at: index).
+                        newMessageSelections add: (messageSelections at: index)]].
+        super deleteAllFromMessageList: aCollection.
+        autoSelectStrings := newAutoSelectStrings.
+        messageSelections := newMessageSelections.
+        anchorIndex ifNotNil:
+                [ anchorIndex := anchorIndex min: messageList size ]!

Item was changed:
  ----- Method: MessageTrace>>removeMessageFromBrowser (in category 'building') -----
  removeMessageFromBrowser
         | indexToSelect |
         "Try to keep the same selection index."
         indexToSelect := (messageSelections indexOf: true) max: 1.
+        self deleteAllFromMessageList: self selectedMessages.
-        self selectedMessages do: [ :eachMethodReference | self deleteFromMessageList: eachMethodReference ].
         self deselectAll.
         messageSelections ifNotEmpty:
                 [ messageSelections
                         at: (indexToSelect min: messageSelections size)  "safety"
                         put: true ].
         anchorIndex := indexToSelect min: messageSelections size.
         self
                 messageListIndex: anchorIndex ;
                 reformulateList!




Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Tools-jr.930.mcz

Jakob Reschke
I actually stole/copied that bad style from the original deleteFromMessageList: ;-)


Am Sa., 8. Feb. 2020 um 18:29 Uhr schrieb Thiede, Christoph <[hidden email]>:

+        | currIdx |


I don't think Smalltalk code needs such counterintuitive abbreviations.

{currIdx. messageList size.} min

could be written as: (currIdx min: messageList size).


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Tools-jr.930.mcz

Christoph Thiede

Well, in this case, you're acquitted ;-)

Von: Squeak-dev <[hidden email]> im Auftrag von Jakob Reschke <[hidden email]>
Gesendet: Samstag, 8. Februar 2020 18:53:41
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] The Inbox: Tools-jr.930.mcz
 
I actually stole/copied that bad style from the original deleteFromMessageList: ;-)


Am Sa., 8. Feb. 2020 um 18:29 Uhr schrieb Thiede, Christoph <[hidden email]>:

+        | currIdx |


I don't think Smalltalk code needs such counterintuitive abbreviations.

{currIdx. messageList size.} min

could be written as: (currIdx min: messageList size).


Carpe Squeak!