Quantcast
Channel: Active questions tagged ocaml - Stack Overflow
Viewing all articles
Browse latest Browse all 518

How to read large files faster [closed]

$
0
0

I am writing a parser in OCaml and first I need a function to read the object file. I wrote the following function to read the contents of the target file and convert it to string output:

let read_all_lines filename : string =  let contents = In_channel.with_open_bin filename In_channel.input_all in  contents

When I use this function to read large files, it takes a long time. For example, a file with more than 20,000 lines of code would take 20 seconds to read. Is there any way to optimize it?


Viewing all articles
Browse latest Browse all 518

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>