Skip to content

Commit

Permalink
browser: speed up ui with caches
Browse files Browse the repository at this point in the history
  • Loading branch information
LinqLover committed Jan 4, 2025
1 parent 87ddf57 commit f231439
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
private
cached: aBlock

^ caches at: aBlock method ifAbsentPut: aBlock
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
updating
changed: aspect

super changed: aspect.

caches keys do: [:key |
((self pragmaAspectDependencies at: key selector) includes: aspect) ifTrue:
[caches removeKey: key]].

(self dependentAspectsOn: aspect)
do: [:dependentAspect | self changedDependent: dependentAspect].
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ accessing - toolbuilder
classLabels
<uses: #(classes displayedResults)>

^ self classes collect: [:class |
self labelForClass: class]
^ self cached:
[self classes collect: [:class |
self labelForClass: class]]
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ accessing
displayedTests
<uses: #(displayedResults shouldDisplayAllTests tests)>

self shouldDisplayAllTests ifTrue: [^ self tests].
^ self displayedResults collect: #test as: Set
^ self cached:
[self shouldDisplayAllTests
ifTrue: [self tests]
ifFalse: [self displayedResults collect: #test as: Set]]
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ initialize

super initialize.

caches := IdentityDictionary new.

self shouldDisplayAllTests: self defaultShouldDisplayAllTests.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
accessing
resultsForTestSelection
<uses: #(selectedTestNode displayedResults)>

self hasTestNodeSelected ifFalse: [^ self displayedResults].

^ self resultsForTestNode: self selectedTestNode
^ self cached:
[self hasTestNodeSelected
ifFalse: [self displayedResults]
ifTrue: [self resultsForTestNode: self selectedTestNode]]
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
"buildTestTree:" : "ct 12/21/2024 20:36",
"buildWith:" : "ct 12/10/2024 23:20",
"buttonBarHeight" : "ct 12/10/2024 23:09",
"cached:" : "ct 12/22/2024 01:07",
"changeTarget" : "ct 12/17/2024 21:48",
"changed:" : "ct 12/22/2024 01:13",
"childrenForTestCategory:" : "ct 12/19/2024 21:06",
"childrenForTestNode:" : "ct 12/21/2024 20:49",
"childrenForTestNodePath:" : "ct 12/18/2024 04:42",
"chooseTarget" : "ct 12/12/2024 01:59",
"classLabels" : "ct 12/21/2024 20:49",
"classLabels" : "ct 1/4/2025 22:09",
"classListMenu:" : "ct 12/13/2024 00:39",
"classListMenu:shifted:" : "ct 12/13/2024 00:36",
"classListMenuMore:" : "ct 12/13/2024 00:39",
Expand All @@ -38,7 +40,7 @@
"defaultWindowColor" : "ct 12/10/2024 23:28",
"displayedResults" : "ct 12/21/2024 20:49",
"displayedTestCategories" : "ct 12/18/2024 02:27",
"displayedTests" : "ct 12/21/2024 20:50",
"displayedTests" : "ct 1/4/2025 22:13",
"hasMessageSelected" : "ct 12/12/2024 06:48",
"hasMethodSelected" : "ct 12/17/2024 21:25",
"hasRealClassSelected" : "ct 12/18/2024 04:58",
Expand All @@ -49,7 +51,7 @@
"helpForMessageAt:" : "ct 12/21/2024 21:17",
"helpForTestNode:" : "ct 12/21/2024 20:34",
"helpForTestNodePath:" : "ct 12/21/2024 20:32",
"initialize" : "ct 12/18/2024 03:07",
"initialize" : "ct 1/4/2025 22:02",
"inspectSelectedResults" : "ct 12/19/2024 21:29",
"inspectSelectedTestNode" : "ct 12/21/2024 20:39",
"isMessageOutOfSync:" : "ct 12/21/2024 21:22",
Expand All @@ -75,7 +77,7 @@
"resultsForTestAndClassSelectionAndMessage:" : "ct 12/18/2024 04:55",
"resultsForTestAndMessageSelection" : "ct 12/18/2024 03:38",
"resultsForTestNode:" : "ct 12/21/2024 20:50",
"resultsForTestSelection" : "ct 12/21/2024 20:50",
"resultsForTestSelection" : "ct 1/4/2025 22:01",
"resultsForTestSelectionAndClass:" : "ct 12/17/2024 22:17",
"runTests" : "ct 12/12/2024 04:02",
"runnerClass" : "ct 12/12/2024 04:02",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"selectedClass",
"selectedMessageName",
"selectedTestNodePath",
"testNodePaths" ],
"testNodePaths",
"caches" ],
"name" : "SwaLintBrowser",
"pools" : [
],
Expand Down

0 comments on commit f231439

Please sign in to comment.