[ENH] lineEndingsTweak-ls

Andreas Raab andreas.raab at gmx.de
Mon Sep 22 01:41:29 UTC 2003


Hi Lex,

> This matters when a lot of small strings are being
> converted, e.g. individual lines of a large text file.

Sounds like a job for TextFile to me:

Benchmark 1:
	file := TextFile readOnlyFileNamed: Smalltalk changesName.
	time := [[file atEnd] whileFalse:[file nextLine]] timeToRun.
	file close.

StandardFileStream: 	 23,504 msecs
CrLfFileStream: 		180,138 msecs
TextFile: 			  7,649 msecs


Benchmark 2:
	file := TextFile readOnlyFileNamed: Smalltalk changesName.
	MessageTally spyOn:[[file atEnd] whileFalse:[file nextChunk]].
	file close.

StandardFileStream:	142,486 msecs
CrLfFileStream:		175,300 msecs
TextFile:			 32,753 msecs

Cheers,
  - Andreas

> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org 
> [mailto:squeak-dev-bounces at lists.squeakfoundation.org] On 
> Behalf Of Lex Spoon
> Sent: Monday, September 22, 2003 2:10 AM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: [ENH] lineEndingsTweak-ls
> 
> 
> from preamble:
> 
> "Change Set:		lineEndingsTweak-ls
> Date:			21 September 2003
> Author:			Lex Spoon
> 
> Stupid tweak for withSqueakLineEndings.  Information from a class
> variable was being recomputed every time the method runs.  
> This matters
> when a lot of small strings are being converted, e.g. individual lines
> of a large text file.
> "!
> 



More information about the Squeak-dev mailing list