I think you have a point. Are you going to propose a change?
Post by Chris Muller
Unrelated to the change itself, here's another example of the
deleterious effects of trying to improve performance at the expense of
proper encapsulation and late-binding dynamism.
I'm referring to the use of an IdentityDictionary for the Smalltalk
Environment instead of a regular Dictionary.
Not ONLY does force ALL clients to make assumptions about internal
- not ONLY duplicating this poor #asSymbol coding style again and again,
- it actually screws them over on performance in the real world
-- where the class names are likely to have come from an external source,
therefore as a String, forcing an extra lookup in the Symbol table
that is worse than the original single Dictionary lookup.
| iddict dict |
iddict := Smalltalk globals instVarNamed: 'declarations'.
dict := iddict as: Dictionary.
[ iddict at: 'Integer' asSymbol ] bench.
[ dict at: 'Integer' ] bench
#('1,490,000 per second. 669 nanoseconds per run.' '3,620,000 per
second. 276 nanoseconds per run.')
Optimization is like whack-a-mole. Optimizing one thing invariably
incurs a cost on something else. So would it not be best to choose
the trade-offs that actually *gain in the real-world* than ones that
gain only in the lab? Chasing that last 1% gain achieved in the lab,
narrowed the usability, resulting in across-the-board losses for the
real world: in code-quality, dynamism AND performance by a whopping
Post by email@example.com
==================== Summary ====================
Time: 29 November 2018, 2:00:34.775887 pm
Fix a bug in SHMCClassDefinition>>sharedPools that answered nil as the pool for a missing pool, and hence broke khighlighting in the Monticello package browser when browsing older version s with different pool dictionary definitions.
=============== Diff against ShoutCore-tpr.61 ===============
----- Method: SHMCClassDefinition>>sharedPools (in category 'act like a class') -----
| d |
d := Set new.
+ (Smalltalk at: poolName asSymbol ifAbsent:[nil]) ifNotNil: [:pool| d add: pool]].
- classDefinition poolDictionaries do:[:each |
- d add: (Smalltalk at: each asSymbol ifAbsent:[nil]) ].