[squeak-dev] The Trunk: Compression-dtl.59.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Jan 26 20:06:57 UTC 2022


David T. Lewis uploaded a new version of Compression to project The Trunk:
http://source.squeak.org/trunk/Compression-dtl.59.mcz

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

Name: Compression-dtl.59
Author: dtl
Time: 26 January 2022, 2:49:08.713265 pm
UUID: 879b294e-720a-41f7-a363-23c157ac41cd
Ancestors: Compression-ct.57

40X speedup for CompressedSourcesStream>>contentsOfEntireFile
CompressedSourceStream>>next: is recursive, so processing the contents in chunks can be much faster. Also enable use of a progress bar when reading the compressed contents.

=============== Diff against Compression-ct.57 ===============

Item was changed:
  ----- Method: CompressedSourceStream>>contentsOfEntireFile (in category 'access') -----
  contentsOfEntireFile
+ 	^ self uncompressedBytes: [ :bar | "bar ignored"]
+ !
- 	| contents |
- 	self position: 0.
- 	contents := self next: self size.
- 	self close.
- 	^ contents!

Item was added:
+ ----- Method: CompressedSourceStream>>into:chunkSize:notifying: (in category 'private') -----
+ into: byteStream chunkSize: chunkSize notifying: progress
+ 	"Decompress sources into a byte stream, notifying a progress dialog.
+ 	Reading from the compressed sources is recursive, so reading in chunks
+ 	can be more efficient, and is also convenient for updating a progress bar."
+ 
+ 	self position: 0.
+ 	[self position < self size]
+ 		whileTrue: [
+ 			progress value: self position / self size.
+ 			byteStream nextPutAll: (self next: chunkSize)]
+ !

Item was added:
+ ----- Method: CompressedSourceStream>>uncompressedBytes: (in category 'access') -----
+ uncompressedBytes: progress
+ 
+ 	"ProgressInitiationException
+ 		display: 'reading compressed sources from a compressed .stc file'
+ 		during: [:bar | (SourceFiles at: 1) uncompressedBytes: bar]"
+ 
+ 	^ ByteString streamContents: [ :strm |
+ 		self readOnlyCopy reset into: strm chunkSize: 50000 notifying: progress].
+ 
+ !



More information about the Squeak-dev mailing list