The Trunk: Morphic-eem.1063.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Morphic-eem.1063.mcz

commits-2
Eliot Miranda uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-eem.1063.mcz

==================== Summary ====================

Name: Morphic-eem.1063
Author: eem
Time: 5 January 2016, 5:44:45.9636 pm
UUID: 5874da4f-b659-476a-8f3f-ac77ab444305
Ancestors: Morphic-eem.1062

Avoid translating strings in MenuIcons redundantly on start-up.  This is for the VM simulator, but it'll also shave a few milliseconds off start-up, even on a fast machine (e.g. my 2.2GHz Core i7 takes ~ 3.75msecs to initializeTranslations).

=============== Diff against Morphic-eem.1062 ===============

Item was changed:
  Object subclass: #MenuIcons
  instanceVariableNames: ''
+ classVariableNames: 'Icons TranslatedIcons TranslationLocale'
- classVariableNames: 'Icons TranslatedIcons'
  poolDictionaries: ''
  category: 'Morphic-Menus'!
 
  !MenuIcons commentStamp: 'sd 11/9/2003 14:09' prior: 0!
  I represent a registry for icons.  You can see the icons I contain using the following script:
 
  | dict methods |
  dict := Dictionary new.
  methods := MenuIcons class selectors select: [:each | '*Icon' match: each asString].
  methods do: [:each | dict at: each put: (MenuIcons perform: each)].
  GraphicalDictionaryMenu openOn: dict withLabel: 'MenuIcons'!

Item was changed:
  ----- Method: MenuIcons class>>initializeTranslations (in category 'class initialization') -----
  initializeTranslations
  "Initialize the dictionary of <translated menu string>-><icon>"
 
+ TranslationLocale := LocaleID current.
  TranslatedIcons := Dictionary new.
+ self itemsIcons do:
+ [:assoc|
+ assoc key do:
+ [:str| TranslatedIcons at: str translated asLowercase put: assoc value]]!
- self itemsIcons do: [ :assoc |
- assoc key do: [ :str | TranslatedIcons at: str translated asLowercase put: assoc value ]
- ]!

Item was changed:
  ----- Method: MenuIcons class>>startUp: (in category 'class initialization') -----
  startUp: resuming
+ resuming ifFalse: [^self].
+ TranslationLocale = LocaleID current ifTrue:
+ [^self].
- resuming
- ifFalse: [^ self].
  self initializeTranslations!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-eem.1063.mcz

timrowledge

> On 06-01-2016, at 1:45 AM, [hidden email] wrote:
>
> Avoid translating strings in MenuIcons redundantly on start-up.  This is for the VM simulator, but it'll also shave a few milliseconds off start-up, even on a fast machine (e.g. my 2.2GHz Core i7 takes ~ 3.75msecs to initializeTranslations).

A related issue that took *forever* on a Pi during Scratch startup was using multibytefilestreamfile (or whatever) to read the translation file(s). Changing to use a plain old fashioned stream and handling the specifically unicodish parts via unicode made a high-factor improvement. If there are any similar cases in trunk it would be nice to improve them.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Strange OpCodes: SFA: Seek Financial Assistance