From f360e7344e045d127ad1c3d5e6b7d4e599d8f50e Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Thu, 19 Dec 2024 22:44:17 +0100 Subject: [PATCH] Accelerate loading of plugins by using observer pattern instead of #allInstancesDo: 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. --- packages/SwaLint-Core.package/.squot-contents | 2 ++ .../SLDefaultDialog.class/instance/onEnvironment..st | 2 ++ .../SLDefaultDialog.class/instance/update..st | 6 ++++++ .../SLDefaultDialog.class/methodProperties.json | 3 ++- .../instance/fetchSystemClasses.st | 2 +- .../SLDefaultEnvironment.class/methodProperties.json | 2 +- .../SLEnvironment.class/instance/addPlugIn..st | 10 ++-------- .../SLEnvironment.class/instance/basicAddPlugIn..st | 9 +++++++++ .../SLEnvironment.class/instance/basicRemovePlugIn..st | 6 ++++++ .../SLEnvironment.class/instance/removePlugIn..st | 6 ++---- .../SLEnvironment.class/methodProperties.json | 6 ++++-- .../SwaLint.class/class/refreshAllDialogs.st | 6 ------ .../SwaLint.class/methodProperties.json | 1 - 13 files changed, 37 insertions(+), 24 deletions(-) create mode 100644 packages/SwaLint-Core.package/SLDefaultDialog.class/instance/update..st create mode 100644 packages/SwaLint-Core.package/SLEnvironment.class/instance/basicAddPlugIn..st create mode 100644 packages/SwaLint-Core.package/SLEnvironment.class/instance/basicRemovePlugIn..st delete mode 100644 packages/SwaLint-Core.package/SwaLint.class/class/refreshAllDialogs.st diff --git a/packages/SwaLint-Core.package/.squot-contents b/packages/SwaLint-Core.package/.squot-contents index 4ad0c330..ff6d9236 100644 --- a/packages/SwaLint-Core.package/.squot-contents +++ b/packages/SwaLint-Core.package/.squot-contents @@ -1,4 +1,6 @@ SquotTrackedObjectMetadata { #objectClassName : #PackageInfo, + #id : UUID [ 'a13546282d404a8e98ff29387e39c8c8' ], + #objectsReplacedByNames : true, #serializer : #SquotCypressCodeSerializer } \ No newline at end of file diff --git a/packages/SwaLint-Core.package/SLDefaultDialog.class/instance/onEnvironment..st b/packages/SwaLint-Core.package/SLDefaultDialog.class/instance/onEnvironment..st index e9a888be..e68f5cfd 100644 --- a/packages/SwaLint-Core.package/SLDefaultDialog.class/instance/onEnvironment..st +++ b/packages/SwaLint-Core.package/SLDefaultDialog.class/instance/onEnvironment..st @@ -1,5 +1,7 @@ initialization onEnvironment: aSLEnvironment + self removeDependent: environment. environment := aSLEnvironment. + self addDependent: environment. self update. \ No newline at end of file diff --git a/packages/SwaLint-Core.package/SLDefaultDialog.class/instance/update..st b/packages/SwaLint-Core.package/SLDefaultDialog.class/instance/update..st new file mode 100644 index 00000000..e0ca55b2 --- /dev/null +++ b/packages/SwaLint-Core.package/SLDefaultDialog.class/instance/update..st @@ -0,0 +1,6 @@ +updating +update: aspect + + aspect == self environment ifTrue: + [self update]. + ^ super update: aspect \ No newline at end of file diff --git a/packages/SwaLint-Core.package/SLDefaultDialog.class/methodProperties.json b/packages/SwaLint-Core.package/SLDefaultDialog.class/methodProperties.json index b563af38..b6990608 100644 --- a/packages/SwaLint-Core.package/SLDefaultDialog.class/methodProperties.json +++ b/packages/SwaLint-Core.package/SLDefaultDialog.class/methodProperties.json @@ -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", @@ -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", diff --git a/packages/SwaLint-Core.package/SLDefaultEnvironment.class/instance/fetchSystemClasses.st b/packages/SwaLint-Core.package/SLDefaultEnvironment.class/instance/fetchSystemClasses.st index 09360e53..7703147e 100644 --- a/packages/SwaLint-Core.package/SLDefaultEnvironment.class/instance/fetchSystemClasses.st +++ b/packages/SwaLint-Core.package/SLDefaultEnvironment.class/instance/fetchSystemClasses.st @@ -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]]. \ No newline at end of file diff --git a/packages/SwaLint-Core.package/SLDefaultEnvironment.class/methodProperties.json b/packages/SwaLint-Core.package/SLDefaultEnvironment.class/methodProperties.json index 4ec1c7a3..8f881e43 100644 --- a/packages/SwaLint-Core.package/SLDefaultEnvironment.class/methodProperties.json +++ b/packages/SwaLint-Core.package/SLDefaultEnvironment.class/methodProperties.json @@ -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", diff --git a/packages/SwaLint-Core.package/SLEnvironment.class/instance/addPlugIn..st b/packages/SwaLint-Core.package/SLEnvironment.class/instance/addPlugIn..st index ad23c8a0..0498e3f3 100644 --- a/packages/SwaLint-Core.package/SLEnvironment.class/instance/addPlugIn..st +++ b/packages/SwaLint-Core.package/SLEnvironment.class/instance/addPlugIn..st @@ -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. \ No newline at end of file + self basicAddPlugIn: aSLPlugInClass. + self changed: #plugIns. \ No newline at end of file diff --git a/packages/SwaLint-Core.package/SLEnvironment.class/instance/basicAddPlugIn..st b/packages/SwaLint-Core.package/SLEnvironment.class/instance/basicAddPlugIn..st new file mode 100644 index 00000000..5cb4a134 --- /dev/null +++ b/packages/SwaLint-Core.package/SLEnvironment.class/instance/basicAddPlugIn..st @@ -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]. \ No newline at end of file diff --git a/packages/SwaLint-Core.package/SLEnvironment.class/instance/basicRemovePlugIn..st b/packages/SwaLint-Core.package/SLEnvironment.class/instance/basicRemovePlugIn..st new file mode 100644 index 00000000..b3276ec2 --- /dev/null +++ b/packages/SwaLint-Core.package/SLEnvironment.class/instance/basicRemovePlugIn..st @@ -0,0 +1,6 @@ +private +basicRemovePlugIn: aSLPlugInClass + + aSLPlugInClass subclassesDo: [:subclass | self basicRemovePlugIn: subclass]. + aSLPlugInClass offeredTests do: [ :each | + self removeTest: each]. \ No newline at end of file diff --git a/packages/SwaLint-Core.package/SLEnvironment.class/instance/removePlugIn..st b/packages/SwaLint-Core.package/SLEnvironment.class/instance/removePlugIn..st index 5dd2deb2..dbbfd5ee 100644 --- a/packages/SwaLint-Core.package/SLEnvironment.class/instance/removePlugIn..st +++ b/packages/SwaLint-Core.package/SLEnvironment.class/instance/removePlugIn..st @@ -1,7 +1,5 @@ updating removePlugIn: aSLPlugInClass - aSLPlugInClass subclassesDo: [:subclass | self removePlugIn: subclass]. - aSLPlugInClass offeredTests do: [ :each | - self removeTest: each]. - SwaLint refreshAllDialogs. \ No newline at end of file + self basicRemovePlugIn: aSLPlugInClass. + self changed: #plugIns. \ No newline at end of file diff --git a/packages/SwaLint-Core.package/SLEnvironment.class/methodProperties.json b/packages/SwaLint-Core.package/SLEnvironment.class/methodProperties.json index ca7734ae..f4107e23 100644 --- a/packages/SwaLint-Core.package/SLEnvironment.class/methodProperties.json +++ b/packages/SwaLint-Core.package/SLEnvironment.class/methodProperties.json @@ -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", @@ -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", diff --git a/packages/SwaLint-Core.package/SwaLint.class/class/refreshAllDialogs.st b/packages/SwaLint-Core.package/SwaLint.class/class/refreshAllDialogs.st deleted file mode 100644 index baaee3ee..00000000 --- a/packages/SwaLint-Core.package/SwaLint.class/class/refreshAllDialogs.st +++ /dev/null @@ -1,6 +0,0 @@ -initialize-release -refreshAllDialogs - - [SLDefaultDialog allInstancesDo: [ :instance | instance update ]] ifError: []. - SLDefaultDialog subclassesDo: [ :each | - [each allInstancesDo: [ :instance | instance update ]] ifError: []]. \ No newline at end of file diff --git a/packages/SwaLint-Core.package/SwaLint.class/methodProperties.json b/packages/SwaLint-Core.package/SwaLint.class/methodProperties.json index 494d0736..30c2bfc3 100644 --- a/packages/SwaLint-Core.package/SwaLint.class/methodProperties.json +++ b/packages/SwaLint-Core.package/SwaLint.class/methodProperties.json @@ -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",