FileTest Comparisons
Tim Olson
tim at io.com
Wed Feb 19 14:59:18 UTC 2003
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
|