Efficiently reading a very large text file in C++

I’d redesign this to act streaming, instead of on a block. A simpler approach would be: std::ifstream ifs(“input.txt”); std::vector<uint64_t> parsed(std::istream_iterator<uint64_t>(ifs), {}); If you know roughly how many values are expected, using std::vector::reserve up front could speed it up further. Alternatively you can use a memory mapped file and iterate over the character sequence. How to … Read more