Still on the ICFPC 2007 topic
I am curious about one thing. If I read the file applying hGetContents to a ByteString (Lazy or Strict) or a String, it seems to read much faster than the version where I construct a sequence.
main = do
(arg1:args)<-getArgs
hIn <- openFile arg1 ReadMode
c <-BL.hGetContents hIn --Really Fast
let dna = c
r<-return (process dna)
print (show (r))
main = do
(arg1:args)<-getArgs
hIn <- openFile arg1 ReadMode
c <-hGetContents hIn
let dna = fromList c --Kind of slow
r<-return (process dna)
print (show (r))
I think the "fromList" overhead will be compensated by the O(log(n)) functions on a Seq, against the O(n) counterparts on the strings.
What are your considerations about using Data.Sequence?