
Hello haskellers! I'm trying to process an xml file with as little footprint as possible. SAX is alright for my case, and I think that's the lightest way possible. So, I'm looking at HaXml.SAX I'm surprised to see that it takes about 56-60 MB of ram. This seems constant relative to xml file size, which is expected. Only slightly depends on it as I recursively traverse the list of sax events. But it seems like too much. The size of the file is from 1MB to 20MB. The code is something like this main = do (fn:_) <- getArgs h <- openFile fn ReadMode c <- hGetContents h let out = proc $ fst $ saxParse fn c putStrLn out getChar -- 'f' is tail-recursive -- 'i' is used only to ensure that the list is completely traversed proc es = show $ f es 0 where f :: [SaxElement] -> Int -> Int f (SaxElementOpen name _ : rest) i = f rest i f (_ : rest) i = f rest i f [] i = i Thanks for you thoughts! -- Daniil Elovkov