Skip to content

Commit

Permalink
inbox browser: speed up list construction (cache conversation columns…
Browse files Browse the repository at this point in the history
… + build list lazily when opening)
  • Loading branch information
LinqLover committed Nov 18, 2024
1 parent 6f20296 commit 99deffa
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ clearAllCaches
self terminateBackgroundWorkerFor: #conversations.

allConversations := conversations := #().
cachedConversationColumns := nil.
"Invalidate lists in case clearing gets curtailed."
self inbox class clearAllCaches.
TalkProject clearAllCaches.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ conversationColumns
[:conversation | "involvement icon"
'']} withIndexCollect: [:columnBlock :columnIndex |
self conversations collect: [:conversation |
conversation = #searching ifFalse: [columnBlock value: conversation] ifTrue: [
columnIndex = 1
ifTrue: [
'Searching...' asText
addAttribute: TextEmphasis italic;
yourself]
ifFalse: ['']]]]
conversation = #searching
ifFalse:
[((cachedConversationColumns ifNil: [cachedConversationColumns := Dictionary new])
at: columnIndex ifAbsentPut: [WeakIdentityKeyDictionary new])
at: conversation ifAbsentPut: [columnBlock value: conversation]]
ifTrue:
[columnIndex = 1
ifTrue: [
'Searching...' asText
addAttribute: TextEmphasis italic;
yourself]
ifFalse: ['']]]]
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ toolbuilder
open

| result |
conversations := #().
result := super open.
self selectConversation: nil.
self startGatheringConversations. "run in the background for faster UI responsiveness"
^ result
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ startGatheringConversations
self containingWindow ifNil: [^ self].

conversations := newConversations := OrderedCollection with: #searching.
cachedConversationColumns := nil.
self
backgroundWorkerFor: #conversations
do: [:updateBlock |
Expand All @@ -14,7 +15,7 @@ startGatheringConversations
newConversations add: conversation beforeIndex: newConversations size.
updateBlock value].

newConversations removeLast.
newConversations removeLast. "#searching"
updateBlock value] ifCurtailed: [
conversations := #().
self changed: #conversations]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@
"buildWith:" : "mt 1/11/2023 11:00",
"changed:" : "ct 7/3/2021 02:04",
"changedDependent:" : "ct 7/24/2021 02:02",
"clearAllCaches" : "ct 11/26/2022 23:52",
"clearAllCaches" : "ct 7/10/2024 22:42",
"columnNameAt:" : "ct 7/20/2021 20:22",
"combineContributionConversations:" : "ct 7/2/2021 17:00",
"contents" : "ct 7/3/2021 02:00",
"contributeMenu:" : "ct 7/8/2021 13:32",
"conversationColumns" : "ct 5/15/2023 19:37",
"conversationColumns" : "ct 7/10/2024 22:42",
"conversationHelpAtRow:atColumn:" : "ct 2/1/2024 20:11",
"conversationHelpFor:atColumnNamed:" : "ct 7/20/2021 20:24",
"conversationIconAtRow:atColumn:" : "ct 2/1/2024 20:06",
Expand Down Expand Up @@ -129,7 +129,7 @@
"offerAppMenu" : "ct 7/7/2021 23:00",
"offerContributeMenu" : "ct 7/8/2021 13:19",
"offerFilterMenu" : "ct 6/30/2021 22:45",
"open" : "ct 7/23/2021 16:56",
"open" : "ct 11/18/2024 21:08",
"openConversation" : "ct 7/22/2021 20:27",
"openMonticello" : "ct 7/8/2021 13:32",
"openPreferences" : "ct 7/20/2021 20:13",
Expand All @@ -150,7 +150,7 @@
"showCredits" : "ct 6/25/2023 21:24",
"simpleContents" : "ct 7/22/2021 16:24",
"startComputingContents" : "ct 7/23/2021 17:41",
"startGatheringConversations" : "ct 7/23/2021 16:55",
"startGatheringConversations" : "ct 11/18/2024 03:20",
"step" : "ct 1/10/2023 17:43",
"subjectFor:" : "ct 6/30/2021 19:52",
"totalFilter" : "ct 7/2/2021 16:07",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"numberOfConversations",
"conversations",
"menuFilter",
"contents" ],
"contents",
"cachedConversationColumns" ],
"name" : "TalkInboxBrowser",
"pools" : [
],
Expand Down

1 comment on commit 99deffa

@LinqLover
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This improves the responsiveness of the tool while loading and reduced the loading time for the full squeak-dev list from >50 seconds to 25 seconds for me.

Please sign in to comment.