Skip to content

Commit

Permalink
Accelerate loading of plugins by using observer pattern instead of #a…
Browse files Browse the repository at this point in the history
…llInstancesDo:

Also only trigger the update once for adding all plugins. Tbh I did not test whether the update mechanism actually works because in practice every dialog has its own environment.
  • Loading branch information
LinqLover committed Dec 19, 2024
1 parent 5cac442 commit f360e73
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 24 deletions.
2 changes: 2 additions & 0 deletions packages/SwaLint-Core.package/.squot-contents
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
SquotTrackedObjectMetadata {
#objectClassName : #PackageInfo,
#id : UUID [ 'a13546282d404a8e98ff29387e39c8c8' ],
#objectsReplacedByNames : true,
#serializer : #SquotCypressCodeSerializer
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
initialization
onEnvironment: aSLEnvironment

self removeDependent: environment.
environment := aSLEnvironment.
self addDependent: environment.
self update.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
updating
update: aspect

aspect == self environment ifTrue:
[self update].
^ super update: aspect
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"loadFastTests" : "BD 6/29/2018 15:57",
"loadFullTests" : "BD 6/29/2018 15:48",
"loadSelectionTests" : "BD 6/29/2018 15:19",
"onEnvironment:" : "NA 7/30/2015 14:32",
"onEnvironment:" : "ct 12/13/2024 00:59",
"open" : "NA 6/30/2015 11:55",
"openConfigureDialog" : "NA 7/14/2015 11:43",
"perform:orSendTo:" : "NA 7/2/2015 18:29",
Expand Down Expand Up @@ -116,6 +116,7 @@
"testsSelected:" : "BD 6/29/2018 14:43",
"toggleCategorySelectionMethod" : "NA 7/17/2015 00:49",
"update" : "fm 6/29/2018 03:24",
"update:" : "ct 12/13/2024 01:01",
"updateCategories" : "NA 7/30/2015 14:38",
"updateClasses" : "fm 6/29/2018 03:50",
"updateTestCategories" : "NA 7/30/2015 14:36",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ accessing
fetchSystemClasses

systemClasses := Dictionary new.
Smalltalk allClasses do: [ :aClass |
Smalltalk allClassesDo: [ :aClass |
aClass category ifNotNil: [
(self category: aClass category)
add: aClass name]].
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"class" : {
},
"instance" : {
"fetchSystemClasses" : "BD 6/16/2018 11:19",
"fetchSystemClasses" : "ct 12/13/2024 01:02",
"initialize" : "NA 7/31/2015 18:56",
"initializeInstanceVariables" : "NA 7/29/2015 16:27",
"selectableTestCategories" : "NA 7/28/2015 13:16",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,5 @@ SwaLint
addPlugIn: aSLPlugInClass
"Register all tests offered by the plug-in class."

aSLPlugInClass subclasses
do: [ :subclass | self addPlugIn: subclass]
displayingProgress: ('Loading ', aSLPlugInClass).
aSLPlugInClass offeredTests
do: [ :test | self addTest: test]
displayingProgress: [ :test | 'Loading Test:',test name].

SwaLint refreshAllDialogs.
self basicAddPlugIn: aSLPlugInClass.
self changed: #plugIns.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
private
basicAddPlugIn: aSLPlugInClass

aSLPlugInClass subclasses
do: [ :subclass | self basicAddPlugIn: subclass]
displayingProgress: ('Loading ', aSLPlugInClass).
aSLPlugInClass offeredTests
do: [ :test | self addTest: test]
displayingProgress: [ :test | 'Loading Test: ', test name].
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
private
basicRemovePlugIn: aSLPlugInClass

aSLPlugInClass subclassesDo: [:subclass | self basicRemovePlugIn: subclass].
aSLPlugInClass offeredTests do: [ :each |
self removeTest: each].
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
updating
removePlugIn: aSLPlugInClass

aSLPlugInClass subclassesDo: [:subclass | self removePlugIn: subclass].
aSLPlugInClass offeredTests do: [ :each |
self removeTest: each].
SwaLint refreshAllDialogs.
self basicRemovePlugIn: aSLPlugInClass.
self changed: #plugIns.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
"class" : {
"dataFromEnvironment:" : "JTM 7/28/2015 10:45" },
"instance" : {
"addPlugIn:" : "NA 7/28/2015 13:06",
"addPlugIn:" : "ct 12/13/2024 01:00",
"addTest:" : "NH 7/15/2015 22:41",
"addTest:toCategory:" : "JTM 7/22/2015 13:54",
"basicAddPlugIn:" : "ct 12/19/2024 22:39",
"basicRemovePlugIn:" : "ct 12/13/2024 00:57",
"category:" : "AT 5/8/2008 09:32",
"categoryDict" : "NA 7/29/2015 18:31",
"categoryDict:" : "NH 7/15/2015 22:30",
Expand All @@ -21,7 +23,7 @@
"loadDefaults" : "NA 7/31/2015 18:56",
"packageForCategory:" : "AT 5/8/2008 09:32",
"refresh" : "BD 7/13/2018 11:52",
"removePlugIn:" : "JTM 7/22/2015 14:40",
"removePlugIn:" : "ct 12/13/2024 01:00",
"removeTest:" : "JTM 7/22/2015 14:41",
"selectableClassCategories" : "AT 5/8/2008 09:32",
"selectableTestCategories" : "NR 1/6/2008 17:16",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"projectLogo" : "AT 5/8/2008 10:35",
"projectLogoContents" : "NR 5/28/2008 14:29",
"refresh" : "BD 7/9/2018 18:16",
"refreshAllDialogs" : "NA 7/31/2015 18:42",
"refreshAllEnvironments" : "BD 7/13/2018 11:56",
"registerInWorldMenu" : "topa 4/21/2010 16:54",
"registerPlugIn:" : "LS 6/15/2018 16:07",
Expand Down

1 comment on commit f360e73

@LinqLover
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Especially for larger images, this makes a difference of >=300% for the initial loading time of the test suite window.

Please sign in to comment.