The Trunk: Collections-eem.393.mcz

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

The Trunk: Collections-eem.393.mcz

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

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

Name: Collections-eem.393
Author: eem
Time: 21 October 2010, 9:48:35.262 am
UUID: af89302e-d619-4f64-bbd6-0516acf3c155
Ancestors: Collections-ul.392

WriteStream>ensureACr useful for writing to the transcript.
Add SparseLargeArray (for VM profiler).  Generally useful though.

=============== Diff against Collections-ul.392 ===============

Item was added:
+ SparseLargeTable variableSubclass: #SparseLargeArray
+ instanceVariableNames: 'arrayClass'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Collections-Arrayed'!
+
+ !SparseLargeArray commentStamp: '<historical>' prior: 0!
+ A version of SparseLargeTable that does not populate its bins until a value other than the default is stored.!

Item was added:
+ ----- Method: SparseLargeArray>>analyzeSpaceSaving (in category 'private') -----
+ analyzeSpaceSaving
+
+ | elems tablesTotal nonNilTables lastPage lastChunkSize |
+ elems := 0.
+ tablesTotal := self basicSize.
+ nonNilTables := 0.
+ lastPage := self basicAt: self basicSize.
+ (lastChunkSize := size \\ chunkSize) = 0 ifTrue:
+ [lastChunkSize := chunkSize].
+ 1 to: self basicSize do:
+ [:i | | page |
+ (page := self basicAt: i) ifNotNil:
+ [nonNilTables := nonNilTables + 1.
+ 1 to: (page == lastPage ifTrue: [lastChunkSize] ifFalse: [chunkSize]) do:
+ [:j|
+ (page at: j) ~= defaultValue ifTrue:
+ [elems := elems + 1]]]].
+
+ ^String streamContents:
+ [:strm |
+ strm nextPutAll: 'total: '; print: size.
+ strm nextPutAll: ' elements: '; print: elems.
+ strm nextPutAll: ' tables: '; print: tablesTotal.
+ strm nextPutAll: ' non-nil: '; print: nonNilTables]!

Item was added:
+ ----- Method: SparseLargeArray>>atAllPut: (in category 'accessing') -----
+ atAllPut: anObject
+ "Put anObject at every one of the receiver's indices."
+
+ 1 to: self basicSize do:
+ [:i|
+ self basicAt: i put: nil].
+ defaultValue := anObject!

Item was added:
+ ----- Method: SparseLargeArray>>initChunkSize:size:arrayClass:base:defaultValue: (in category 'initialization') -----
+ initChunkSize: aChunkSize size: aSize arrayClass: aClass base: b defaultValue: d
+ chunkSize := aChunkSize.
+ size := aSize.
+ base := b.
+ defaultValue := d.
+ arrayClass := aClass
+ !

Item was added:
+ ----- Method: SparseLargeArray>>noCheckAt: (in category 'accessing') -----
+ noCheckAt: index
+ ^(self basicAt: index - base // chunkSize + 1)
+ ifNil: [defaultValue]
+ ifNotNil: [:chunk| chunk at: index - base \\ chunkSize + 1]
+ !

Item was added:
+ ----- Method: SparseLargeArray>>noCheckAt:put: (in category 'accessing') -----
+ noCheckAt: index put: value
+ | chunkIndex chunk lastChunkSize |
+ chunkIndex := index - base // chunkSize + 1.
+ (chunk := self basicAt: chunkIndex) ifNil:
+ [value = defaultValue ifTrue:
+ [^value].
+ chunk := arrayClass
+ new: ((chunkIndex == self basicSize
+   and: [(lastChunkSize := size \\ chunkSize) > 0])
+ ifTrue: [lastChunkSize]
+ ifFalse: [chunkSize])
+ withAll: defaultValue.
+ self basicAt: chunkIndex put: chunk].
+ ^chunk at: index - base \\ chunkSize + 1 put: value!

Item was added:
+ ----- Method: WriteStream>>ensureACr (in category 'character writing') -----
+ ensureACr
+ "Append a cr character to the receiver IFF there is not one on the end."
+
+ self ensureEndsWith: Character cr!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Collections-eem.393.mcz

Andreas.Raab
On 10/21/2010 4:48 PM, [hidden email] wrote:

> Eliot Miranda uploaded a new version of Collections to project The Trunk:
> http://source.squeak.org/trunk/Collections-eem.393.mcz
>
> ==================== Summary ====================
>
> Name: Collections-eem.393
> Author: eem
> Time: 21 October 2010, 9:48:35.262 am
> UUID: af89302e-d619-4f64-bbd6-0516acf3c155
> Ancestors: Collections-ul.392
>
> WriteStream>ensureACr useful for writing to the transcript.

Can we perhaps name this method #ensureCr? My first read of the name was
"ensure ACr" and I couldn't really think of what an "ACR" is.

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Collections-eem.393.mcz

Eliot Miranda-2


On Thu, Oct 21, 2010 at 9:55 AM, Andreas Raab <[hidden email]> wrote:
On 10/21/2010 4:48 PM, [hidden email] wrote:
Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.393.mcz

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

Name: Collections-eem.393
Author: eem
Time: 21 October 2010, 9:48:35.262 am
UUID: af89302e-d619-4f64-bbd6-0516acf3c155
Ancestors: Collections-ul.392

WriteStream>ensureACr useful for writing to the transcript.

Can we perhaps name this method #ensureCr? My first read of the name was "ensure ACr" and I couldn't really think of what an "ACR" is.

Agreed.
 

Cheers,
 - Andreas