[squeak-dev] The Trunk: Morphic-mt.1659.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Tue May 19 18:31:08 UTC 2020


Hmm... I don't think the class name matches the icon's identifier that often. Here are some thoughts about performance in tools:

[ToolIcons iconNamed: #collection] bench
--- '6,880,000 per second. 145 nanoseconds per run. 12.64 % GC time.'

[ToolIcons iconNamed: Collection name asLowercase asSymbol] bench 
--- '2,140,000 per second. 467 nanoseconds per run. 4.59908 % GC time.'

[Set withAllSuperclasses
detect: [:cls | ToolIcons respondsTo: cls name asLowercase asSymbol]
ifFound: [:cls | ToolIcons iconNamed: cls name asLowercase asSymbol  "for caching"]
ifNone: [nil]] bench 
--- '303,000 per second. 3.3 microseconds per run. 2.59948 % GC time.'

Best,
Marcel
Am 19.05.2020 20:09:53 schrieb K K Subbu <kksubbu.ml at gmail.com>:
On 19/05/20 12:32 pm, commits at source.squeak.org wrote:
> + ifTrue: [ToolIcons iconNamed: self object class toolIcon]

Instead of adding a toolIcon method to every class, the code can check
if ToolIcons already contains a icon under the class name (in lowercase)

ToolIcons iconNamed: self object class .. ifAbsent: [ ... ]

This will avoid trivial methods like:

Foo class>>toolIcon ^#foo

Regards .. Subbu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200519/f8e41440/attachment-0001.html>


More information about the Squeak-dev mailing list