FileTest Comparisons

Jimmie Houchin jhouchin at texoma.net
Wed Feb 19 16:14:49 UTC 2003


Thanks Tim.

I remember having seen it in messages on the list. But like much 
information when not applied, I forgot all about it.

That sure cleans up the code and provides mo' better information to boot.

Jimmie Houchin


Tim Olson wrote:
> Jimmie Houchin <jhouchin at texoma.net> wrote:
> | Transcript show: 'timeToRun = ', [1 to: 1000 do: [:index |
> | 	t1 := [fname := FileStream newFileNamed: filedir, index asString] 
> | timeToRun.
> | 	t2 := [fname nextPutAll: string] timeToRun.
> | 	t3 := [fname flush] timeToRun.
> | 	t4 := [fname close] timeToRun.
> | 	timeName := timeName + t1.
> | 	timeNPA := timeNPA + t2.
> | 	timeFlush := timeFlush + t3.
> | 	timeClose := timeClose + t4.]]  timeToRun asString; cr.
> 
> When profiling, you might want to use MessageTally>>spyOn:
> 
> MessageTally spyOn:
> 	[1 to: 1000 do:
> 		[:index |
> 		fname := FileStream newFileNamed: filedir, index asString.
> 		fname nextPutAll: string.
> 		fname flush.
> 		fname close]].
> 
> That way you don't have to sprinkle all the "timeToRun" sends in your
> code.  On my system, I get:
> 
>  - 2988 tallies, 56320 msec.
> 
> **Tree**
> 87.3% {49167ms} StandardFileStream>>flush
> 10.5% {5914ms} FileStream class>>newFileNamed:
>   |10.5% {5914ms} StandardFileStream class>>newFileNamed:
>   |  10.3% {5801ms} StandardFileStream>>open:forWrite:
>   |    10.2% {5745ms} primitives
> 2.2% {1239ms} StandardFileStream>>close
> 
> 	-- tim
> 
> 
> 




More information about the Squeak-dev mailing list