Skip to content
Tcl Source Code Artifact [2f279ac8ca]
Login

Artifact [2f279ac8ca]

Artifact 2f279ac8cad57b67fe6a718fb4608e903ffe438d:

Ticket change [2f279ac8ca] - New ticket [605074ede5ccc8bc|605074ede5] <i>New sub-command: file utime</i>. by damkerngt on 2013-10-16 21:09:42.
D 2013-10-16T21:09:42.776
J assignee nobody
J closer nobody
J cmimetype text/plain
J comment Proposal:\r\nA\snew\scommand\s[file\sutime]\sfor\sfast\sfile's\satime/mtime\supdate\r\nUsage:\sfile\sutime\sFILENAME\sATIME\sMTIME\r\n\r\nBackground:\r\nI\swrote\sa\ssmall\sTcl\sscript\sthat\scalls\sa\shuge\snumber\sof\s[file\smtime].\sTo\smy\ssurprise,\sI\sfound\sthe\sscript\srun\ssignificantly\sslower\sthan\sPython\simplementation.\sEven\sworse,\sI\sfound\sthat\scalling\s[exec\stouch\s-d\s[clock\sformat\s$mtime\s-format]\s$file]\scan\ssometimes\sbe\sfaster\sthan\s[file\smtime\s$file\s$mtime].\r\n\r\nHere\sare\ssome\sbenchmarks\son\smy\sWindows\sXP.\sPlease\snote\sthat\sthis\spoor\sperformance\soccurs\sonly\swhen\swe\supdate\sa\slarge\snumber\sof\sfiles\sconsecutively,\snot\sin\san\sunrealistic\stest\ssuch\sas\s[time\s{file\smtime\s$file\s$mtime}\s10000].\sA\squick\stest\son\sUbuntu\sresulted\sin\ssimilar\spoor\sperformance.\r\n\r\nTask:\supdate\smtime\sof\sabout\s7500\sfiles\r\nTcl\s8.4.5,\susing\s[file\smtime]:\s127\sseconds\r\nTcl\s8.4.5,\susing\s[exec\stouch]:\s123\sseconds\r\nTcl\s8.5.12,\susing\s[file\smtime]:\s43\sseconds\r\nTcl\s8.5.12,\susing\s[exec\stouch]:\s126\sseconds\r\nTcl\s8.6.0,\susing\s[file\smtime]:\s56\sseconds\r\nTcl\s8.6.0,\susing\s[exec\stouch]:\s124\sseconds\r\nPython\s2.7.3,\susing\sos,utime():\s4\sseconds\r\n\r\nBeing\scurious,\sI\stook\sTcl\s8.5.11\ssource\scode,\shacked\sthe\sfile\sgeneric/tclCmdAH.c\sto\snot\sto\scall\sthose\sGetStatBuf()\sbefore\sand\safter\scalling\sTcl_FSUtime().\sThe\sresult:\r\n\r\nTcl\s8.5.11\s(hacked\s[file\smtime]):\s7\sseconds\r\n\r\nwhich\sis\sa\sbig\simprovement.\sThis\salso\sindicates\sthat\sthe\sI/O\sbottleneck\slies\sin\sstat().\sHence\smy\sproposal.\r\n\r\nRationale:\r\nAt\sfirst,\sI\swas\stempted\sto\ssuggest\sto\sremove\sthe\stwo\sGetStatBuf()\scalls\sin\s[file\smtime]\simplementation.\sBut\saccording\sto\sTcl's\sdocumentation,\s[file\smtime],\swith\s3\sor\s4\sarguments,\sreturns\smtime\sin\sboth\scases.\sSo\swe\sneed\sto\sGetStatBuf()\safter\sTcl_FSUtime().\sAnd\ssince\sTcl_FSUtime()\sneeds\sboth\satime\sand\smtime,\swe\sneed\sGetStatBuf()\sto\sretrieve\satime\sbefore\ssetting\smtime\sanyway,\sso\swe\scan\sneither\sremove\sthe\sGetStatBuf()\sbefore\snor\safter\sthe\sTcl_FSUtime()\scall.\r\n\r\nThat\swould\sleft\sus\swith\san\sunderperformed\s[file\smtime]\sin\san\sI/O\sintensive\ssituation.\sTo\sallow\sperformance\simprovement\swhile\sstill\skeeping\sbackward\scompatibility,\sa\snew\ssub-command\s[file\sutime]\s(named\safter\sTcl's\sexisting\sinternal\sfunction\sTcl_FSUtime)\sseems\sto\sbe\sa\sgood\schoice.
J foundin 8.4,\s8.5,\s8.6
J is_private 0
J login damkerngt
J priority 5\sMedium
J private_contact 5b861da73eb25bd34a919c8675a3381d9132b73b
J resolution None
J severity Important
J status Open
J submitter damkerngt
J subsystem 16.\sCommands\sA-H
J title New\ssub-command:\sfile\sutime
J type RFE
K 605074ede5ccc8bc3fdd67e339575c45bd1a1522
U damkerngt
Z 5e7b84dbb2bfd2b48d346334b05a51b2