Dealing with large files in Haskell

前端 未结 3 2116
别跟我提以往
别跟我提以往 2021-02-14 09:33

I have a large file (4+ gigs) of, lets just say, 4 byte floats. I would like to treat it as List, in the sense that I would like to be able to use map, filter, foldl, etc. Howev

3条回答
  •  难免孤独
    2021-02-14 10:03

    You should not treat it as a [Double] or [Float] in memory. What you could do is use one of the list-like packed array types, such as uvector/vector/... in company with mmapFile or readFile to pull chunks of the file in at a time, and process them. Or use a lazy packed array type, equivalent to lazy bytestrings.

提交回复
热议问题