Turns out my test wasn't all that useful, since the OS has a bit of a bottleneck grabbing the info from 12,000+ files in a single directory.

Running the same test on a folder that has only a few hundred files gives a per-file speed more on par with what we might expect:

# File: 329  Total: 9ms  Per file: 0.027356ms

MacBook Pro, 2.16 GHz, 2MB RAM

--
 Richard Gaskin
 Managing Editor, revJournal
 _______________________________________________________
 Rev tips, tutorials and more: http://www.revJournal.com



Richard Gaskin wrote:
Test:

Make a stack with one button containing the script below, and one field named "r". I set the tabstops of the field to 300, and turned on the vGrid and hGrid for column cropping.



Result:

# Files: 12883  Total: 3650ms  Per file: 0.283319ms



Code:

on mouseUp
   -- Get folder:
   answer folder "Select a folder:"
   if it is empty then exit to top
   --
   -- Run function, with timing:
   put the millisecs into t
   put FileListInfo(it) into tmp
   put the millisecs - t into t
   --
   -- Display function result in field, and test result in Msg:
   put  tmp into fld "r"
   put the number of lines of fld "r" into n
   put "# File: "&n&"  Total: "&t &"ms  Per file: "& t/n &"ms"
end mouseUp


function FileListInfo pDir
   -- Get list of file info:
   put the directory into tSaveDir
   set the directory to pDir
   put the detailed files into tFileList
   set the directory to tSaveDir
   -- Parse for display:
   put empty into tFileInfo
   repeat for each line tLine in tFileList
     put urlDecode(item 1 of tLine) &tab& \
         item 2 of tLine + item 3 of tLine &cr after tFileInfo
   end repeat
   --
   return tFileInfo
end FileListInfo
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to