[squeak-dev] The Trunk: EToys-nice.369.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Nov 17 14:49:49 UTC 2019


Nicolas Cellier uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-nice.369.mcz

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

Name: EToys-nice.369
Author: nice
Time: 17 November 2019, 3:49:19.084237 pm
UUID: 6bc2f1bf-b9c6-45e1-8780-e0a2d826b233
Ancestors: EToys-mt.368

Replace (findTokens: Character separators) with substrings which is both a shorter and faster idiom.

| tmp |
tmp := String allSubInstances.
{
[tmp do: [:e | e substrings]] bench.
[tmp do: [:e | e findTokens: Character separators]] bench.
[tmp do: [:e | e findTokens: CharacterSet separators]] bench.
}.
 #(
'1.17 per second. 852 milliseconds per run. 16.22996 % GC time.'
'0.285 per second. 3.51 seconds per run. 5.30746 % GC time.'
'1.18 per second. 849 milliseconds per run. 20.13357 % GC time.')

=============== Diff against EToys-mt.368 ===============

Item was changed:
  ----- Method: BookMorph>>textSearchAgain (in category '*Etoys-Squeakland-menu') -----
  textSearchAgain
  	"The classic find-again"
  
  	| wanted wants list |
  	list := self valueOfProperty: #searchKey ifAbsent: [#()].
  	wanted := String streamContents: [:strm | 
  			list do: [:each | strm nextPutAll: each; space]].
+ 	wants := wanted substrings.
- 	wants := wanted findTokens: Character separators.
  	wants isEmpty ifTrue: [^ self].
  	self getAllText.		"save in allText, allTextUrls"
  	^ self findText: wants	"goes to the page and highlights the text"!

Item was changed:
  ----- Method: CardPlayer>>asKeys (in category 'card data') -----
  asKeys
  	| keys kk vd gotData |
  	"Take my fields, tokenize the text, and return as an array in the same order as variableDocks.  Simple background fields on the top level.  If no data, return nil."
  
  	keys := self class variableDocks copy.
  	gotData := false.
  	1 to: keys size do: [:ind |
  		kk := nil.
  		vd := self class variableDocks at: ind.
  		vd type == #text ifTrue: [
  			kk := (self perform: vd playerGetSelector) string
+ 					substrings.
- 					findTokens: Character separators.
  			kk isEmpty ifTrue: [kk := nil] ifFalse: [gotData := true]].
  		keys at: ind put: kk].
  	^ gotData ifTrue: [keys] ifFalse: [nil]!



More information about the Squeak-dev mailing list