Posted to tcl by mcvoy at Fri Oct 26 15:57:54 GMT 2007view raw
- Profiling results for cat.tcl (see below, it does the read path but skips write) on a million lines of data.
- Each sample counts as 0.01 seconds.
- % cumulative self self total
- time seconds seconds calls s/call s/call name
- 17.59 0.54 0.54 24 0.02 0.02 TclExecuteByteCode
- 8.79 0.81 0.27 1000001 0.00 0.00 Tcl_GetsObj
- 7.82 1.05 0.24 main
- 6.51 1.25 0.20 3001186 0.00 0.00 Tcl_CreateHashEntry
- 3.58 1.36 0.11 3000488 0.00 0.00 CompareStringKeys
- 3.58 1.47 0.11 1000170 0.00 0.00 TclLookupSimpleVar
- 3.26 1.57 0.10 2041601 0.00 0.00 Tcl_ExternalToUtf
- 2.93 1.66 0.09 3001057 0.00 0.00 HashStringKey
- 2.93 1.75 0.09 2041942 0.00 0.00 BinaryProc
- 2.93 1.84 0.09 1000454 0.00 0.00 TclFreeObj
- 2.93 1.93 0.09 1000117 0.00 0.00 TclPtrSetVar
- 2.93 2.02 0.09 1000098 0.00 0.00 TclEvalObjvInternal
- 2.93 2.11 0.09 1000001 0.00 0.00 Tcl_GetsObjCmd
- 2.61 2.19 0.08 1041589 0.00 0.00 FilterInputBytes
- 1.95 2.25 0.06 2041678 0.00 0.00 Tcl_SetObjLength
- 1.95 2.31 0.06 2000159 0.00 0.00 Tcl_GetCommandFromObj
- 1.95 2.37 0.06 1000010 0.00 0.00 Tcl_GetAssocData
- 1.63 2.42 0.05 2041882 0.00 0.00 SetStringFromAny
- 1.63 2.47 0.05 1000007 0.00 0.00 Tcl_ObjSetVar2
- 1.30 2.51 0.04 2003006 0.00 0.00 Tcl_Alloc
- 1.30 2.55 0.04 1000214 0.00 0.00 Tcl_SetObjResult
- 1.30 2.59 0.04 1000120 0.00 0.00 TclpCheckStackSpace
- 1.30 2.63 0.04 1000092 0.00 0.00 Tcl_NewObj
- 1.30 2.67 0.04 1000010 0.00 0.00 Tcl_NewIntObj
- 0.98 2.70 0.03 3000543 0.00 0.00 Tcl_GetThreadData
- 0.98 2.73 0.03 2003114 0.00 0.00 TclpAlloc
- 0.98 2.76 0.03 2000881 0.00 0.00 Tcl_GetStringFromObj
- 0.98 2.79 0.03 1000007 0.00 0.00 CheckChannelErrors
- 0.98 2.82 0.03 1000001 0.00 0.00 CommonGetsCleanup
- 0.65 2.84 0.02 2001914 0.00 0.00 TclpFree
- 0.65 2.86 0.02 2000757 0.00 0.00 Tcl_FindHashEntry
- 0.65 2.88 0.02 1000211 0.00 0.00 TclCleanupCommand
- 0.65 2.90 0.02 1000123 0.00 0.00 Tcl_LimitExceeded
- 0.65 2.92 0.02 1000121 0.00 0.00 Tcl_LimitReady
- 0.65 2.94 0.02 1000120 0.00 0.00 TclInterpReady
- 0.65 2.96 0.02 1000053 0.00 0.00 FreeStringInternalRep
- 0.65 2.98 0.02 1000052 0.00 0.00 TclObjLookupVar
- 0.65 3.00 0.02 1000011 0.00 0.00 Tcl_DeleteFileHandler
- 0.65 3.02 0.02 1000002 0.00 0.00 Tcl_GetChannel
- 0.33 3.03 0.01 3000300 0.00 0.00 Tcl_GetString
- 0.33 3.04 0.01 1000234 0.00 0.00 ResetObjResult
- 0.33 3.05 0.01 1000233 0.00 0.00 Tcl_ResetResult
- 0.33 3.06 0.01 1000214 0.00 0.00 Tcl_GetObjResult
- 0.33 3.07 0.01 1000004 0.00 0.00 FileWatchProc
- 0.00 3.07 0.00 2001914 0.00 0.00 Tcl_Free
- 0.00 3.07 0.00 1000121 0.00 0.00 Tcl_AsyncReady
- proc cat {file} {
- set f [open $file]
- # Good for 11% perf win
- # set buf ""
- while {[gets $f buf] >= 0} {
- }
- close $f
- }
- foreach file $argv {
- cat $file
- }