Article on file line counting algorithms. Covering fast exact counting and statistical counting.

Someone asked a question on the C# newsgroup yesterday and a large number of answers have been flying around.  Some people actually tend to recommend using a StreamReader to count lines (ouch) since they generally work with small files.  The FileStream is probably the best thing to use though since it is down and dirty, though you will have to process the bytes.  I've attempted to create a robust and scalable algorithm that makes use of the userBuffer performance boost, and leveraged that performance boost to count lines in a file using an exact method (processing the whole file), and a set of statistical methods (buffer counting and percentage file counting).  Check it out and let me know what you think.

Fast absolute, and statistical line counting algorithms for use with progress notification

Published Saturday, April 17, 2004 5:45 PM by Justin Rogers

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required)