Christoph Thiede uploaded a new version of HelpSystem-Core to project The Inbox: http://source.squeak.org/inbox/HelpSystem-Core-ct.148.mcz
==================== Summary ====================
Name: HelpSystem-Core-ct.148 Author: ct Time: 15 January 2024, 4:21:10.923083 pm UUID: 726d0b07-7f4e-3a4c-9c62-200777c8c542 Ancestors: HelpSystem-Core-ct.145
Proposal: Speeds up help search by caching sources.
=============== Diff against HelpSystem-Core-ct.145 ===============
Item was added: + ----- Method: SearchTopic>>cacheSourcesDuring: (in category 'private') ----- + cacheSourcesDuring: aBlock + "Some help topics, e.g., ClassAPIHelpTopic, frequently access the source files." + + ^ CurrentReadOnlySourceFiles cacheDuring: aBlock!
Item was changed: ----- Method: SearchTopic>>doSearch (in category 'searching') ----- doSearch "Extension point. Subclasses may override this, e.g., to implement different search strategies."
+ self cacheSourcesDuring: [ + (self topicsToSearch + sorted: [:topic | topic priorityForSearch] ascending) + do: [:topic | + | nestedResults | + nestedResults := OrderedCollection new. + self mutex critical: [results add: topic -> nestedResults]. + self find: self term in: {topic} results: nestedResults]]. - (self topicsToSearch - sorted: [:t1 :t2 | t1 priorityForSearch <= t2 priorityForSearch]) - do: [:topic | - | nestedResults | - nestedResults := OrderedCollection new. - self mutex critical: [results add: topic -> nestedResults]. - self find: self term in: {topic} results: nestedResults]. results add: 'Search finished.' translated.!
The only disadvantage of this proposal is that it couples help to the domain of source files.
Apart from that, this will NOT introduce an overhead when none of the search topics accesses the source files. As I learned today, CurrentReadOnlySourceFiles class>>#cacheDuring: loads the cache lazily on the first request only.
Opinions?
Best, Christoph ________________________________ Von: commits@source.squeak.org commits@source.squeak.org Gesendet: Montag, 15. Januar 2024 16:21 Uhr An: squeak-dev@lists.squeakfoundation.org squeak-dev@lists.squeakfoundation.org Betreff: [squeak-dev] The Inbox: HelpSystem-Core-ct.148.mcz
Christoph Thiede uploaded a new version of HelpSystem-Core to project The Inbox: http://source.squeak.org/inbox/HelpSystem-Core-ct.148.mcz
==================== Summary ====================
Name: HelpSystem-Core-ct.148 Author: ct Time: 15 January 2024, 4:21:10.923083 pm UUID: 726d0b07-7f4e-3a4c-9c62-200777c8c542 Ancestors: HelpSystem-Core-ct.145
Proposal: Speeds up help search by caching sources.
=============== Diff against HelpSystem-Core-ct.145 ===============
Item was added: + ----- Method: SearchTopic>>cacheSourcesDuring: (in category 'private') ----- + cacheSourcesDuring: aBlock + "Some help topics, e.g., ClassAPIHelpTopic, frequently access the source files." + + ^ CurrentReadOnlySourceFiles cacheDuring: aBlock!
Item was changed: ----- Method: SearchTopic>>doSearch (in category 'searching') ----- doSearch "Extension point. Subclasses may override this, e.g., to implement different search strategies."
+ self cacheSourcesDuring: [ + (self topicsToSearch + sorted: [:topic | topic priorityForSearch] ascending) + do: [:topic | + | nestedResults | + nestedResults := OrderedCollection new. + self mutex critical: [results add: topic -> nestedResults]. + self find: self term in: {topic} results: nestedResults]]. - (self topicsToSearch - sorted: [:t1 :t2 | t1 priorityForSearch <= t2 priorityForSearch]) - do: [:topic | - | nestedResults | - nestedResults := OrderedCollection new. - self mutex critical: [results add: topic -> nestedResults]. - self find: self term in: {topic} results: nestedResults].
results add: 'Search finished.' translated.!
What's the speed-up? Looks good.
[...] couples help to the domain of source files.
Would this be a first outside use? What other packages use that caching. Increased coupling should be avoided if brings no or little practical advantages.
Best, Marcel
Am 15.01.2024 16:24:20 schrieb Thiede, Christoph christoph.thiede@student.hpi.uni-potsdam.de:
The only disadvantage of this proposal is that it couples help to the domain of source files.
Apart from that, this will NOT introduce an overhead when none of the search topics accesses the source files. As I learned today, CurrentReadOnlySourceFiles class>>#cacheDuring: loads the cache lazily on the first request only.
Opinions?
Best, Christoph ________________________________ Von: commits@source.squeak.org commits@source.squeak.org Gesendet: Montag, 15. Januar 2024 16:21 Uhr An: squeak-dev@lists.squeakfoundation.org squeak-dev@lists.squeakfoundation.org Betreff: [squeak-dev] The Inbox: HelpSystem-Core-ct.148.mcz
Christoph Thiede uploaded a new version of HelpSystem-Core to project The Inbox: http://source.squeak.org/inbox/HelpSystem-Core-ct.148.mcz
==================== Summary ====================
Name: HelpSystem-Core-ct.148 Author: ct Time: 15 January 2024, 4:21:10.923083 pm UUID: 726d0b07-7f4e-3a4c-9c62-200777c8c542 Ancestors: HelpSystem-Core-ct.145
Proposal: Speeds up help search by caching sources.
=============== Diff against HelpSystem-Core-ct.145 ===============
Item was added: + ----- Method: SearchTopic>>cacheSourcesDuring: (in category 'private') ----- + cacheSourcesDuring: aBlock + "Some help topics, e.g., ClassAPIHelpTopic, frequently access the source files." + + ^ CurrentReadOnlySourceFiles cacheDuring: aBlock!
Item was changed: ----- Method: SearchTopic>>doSearch (in category 'searching') ----- doSearch "Extension point. Subclasses may override this, e.g., to implement different search strategies."
+ self cacheSourcesDuring: [ + (self topicsToSearch + sorted: [:topic | topic priorityForSearch] ascending) + do: [:topic | + | nestedResults | + nestedResults := OrderedCollection new. + self mutex critical: [results add: topic -> nestedResults]. + self find: self term in: {topic} results: nestedResults]]. - (self topicsToSearch - sorted: [:t1 :t2 | t1 priorityForSearch <= t2 priorityForSearch]) - do: [:topic | - | nestedResults | - nestedResults := OrderedCollection new. - self mutex critical: [results add: topic -> nestedResults]. - self find: self term in: {topic} results: nestedResults].
results add: 'Search finished.' translated.!
squeak-dev@lists.squeakfoundation.org