[squeak-dev] The Trunk: System-nice.513.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Feb 24 17:30:31 UTC 2013
Nicolas Cellier uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-nice.513.mcz
==================== Summary ====================
Name: System-nice.513
Author: nice
Time: 24 February 2013, 6:29:23.564 pm
UUID: 496d2bbf-34f3-43cf-9e2f-cae95c1d0604
Ancestors: System-dtl.512
Diminish excessive usage of ReadWriteStream.
Bonus: correct outdated code sample in comment
=============== Diff against System-dtl.512 ===============
Item was changed:
----- Method: Utilities class>>createPageTestWorkspace (in category 'miscellaneous') -----
createPageTestWorkspace
"Used to generate a workspace window for testing page up and page down stuff."
"Utilities createPageTestWorkspace"
| numberOfLines maxStringLength minLineCounterSize lineCounterSize offsetSize stream headerConstant prevStart prevStrLen prevLineNumber |
numberOfLines := 400.
maxStringLength := 22.
minLineCounterSize := 3.
lineCounterSize := (numberOfLines log asInteger + 1) max: minLineCounterSize.
offsetSize := 5.
+ stream := String new writeStream.
- stream := ReadWriteStream on: ''.
headerConstant := lineCounterSize + 1 + offsetSize + 1.
prevStart := headerConstant negated.
prevStrLen := 0.
prevLineNumber := 0.
numberOfLines timesRepeat: [ | log stringLen pad lineNumber charIndex start |
stringLen := maxStringLength atRandom max: 1.
lineNumber := prevLineNumber + 1.
start := prevStart + prevStrLen + headerConstant + 1.
prevStart := start.
prevStrLen := stringLen.
prevLineNumber := lineNumber.
log := lineNumber log asInteger.
pad := lineCounterSize - log - 1.
pad timesRepeat: [stream nextPutAll: '0'].
stream nextPutAll: lineNumber printString.
stream space.
log := start log asInteger.
pad := offsetSize - log - 1.
pad timesRepeat: [stream nextPutAll: '0'].
stream nextPutAll: start printString.
stream space.
charIndex := 'a' first asInteger.
stringLen timesRepeat: [ | char |
char := Character value: charIndex.
charIndex := charIndex + 1.
stream nextPut: char].
lineNumber = numberOfLines ifFalse: [stream cr]
].
UIManager default edit: stream contents label: 'Test Data'.
!
Item was changed:
----- Method: Utilities class>>instanceComparisonsBetween:and: (in category 'miscellaneous') -----
instanceComparisonsBetween: fileName1 and: fileName2
"For differential results, run printSpaceAnalysis twice with different fileNames,
then run this method...
+ SpaceTally new printSpaceAnalysis: 0 on: 'STspace.text1'.
- Smalltalk printSpaceAnalysis: 0 on: 'STspace.text1'.
--- do something that uses space here ---
+ SpaceTally new printSpaceAnalysis: 0 on: 'STspace.text2'.
+ Utilities instanceComparisonsBetween: 'STspace.text1' and: 'STspace.text2'"
- Smalltalk printSpaceAnalysis: 0 on: 'STspace.text2'.
- Smalltalk instanceComparisonsBetween: 'STspace.text1' and 'STspace.text2'"
| instCountDict report f aString items className newInstCount oldInstCount newSpace oldPair oldSpace |
instCountDict := Dictionary new.
+ report := String new writeStream.
- report := ReadWriteStream on: ''.
f := FileStream readOnlyFileNamed: fileName1.
[f atEnd] whileFalse:
[aString := f nextLine.
items := aString findTokens: ' '.
(items size = 4 or: [items size = 5]) ifTrue:
[instCountDict at: items first put: (Array with: items third asNumber with: items fourth asNumber)]].
f close.
f := FileStream readOnlyFileNamed: fileName2.
[f atEnd] whileFalse:
[aString := f nextLine.
items := aString findTokens: ' '.
(items size = 4 or: [items size = 5]) ifTrue:
[className := items first.
newInstCount := items third asNumber.
newSpace := items fourth asNumber.
oldPair := instCountDict at: className ifAbsent: [nil].
oldInstCount := oldPair ifNil: [0] ifNotNil: [oldPair first].
oldSpace := oldPair ifNil: [0] ifNotNil: [oldPair second].
oldInstCount ~= newInstCount ifTrue:
[report nextPutAll: (newInstCount - oldInstCount) printString; tab; nextPutAll: (newSpace - oldSpace) printString; tab; nextPutAll: className asString; cr]]].
f close.
(StringHolder new contents: report contents)
openLabel: 'Instance count differentials between ', fileName1, ' and ', fileName2!
More information about the Squeak-dev
mailing list
|