On Wednesday, 4 October 2017 at 09:04:58 UTC, Biotronic wrote:
Since the code uses ranges though, a simple replacement of readText with an mmapped equivalent should enable humongous file support with no other code change required.
Drop-in replacement for readText: struct MmText { import std.mmfile; ulong _fileOffset; MmFile _file; this(string filename) { _file = new MmFile(filename); } dchar front() { auto end = min(_file.length, _fileOffset+4); auto data = cast(string)_file[_fileOffset..end]; return decodeFront(data); } void popFront() { auto end = min(_file.length, _fileOffset+4); auto data = cast(string)_file[_fileOffset..end]; size_t bytes; decodeFront(data, bytes); _fileOffset += bytes; } bool empty() { return _fileOffset >= _file.length; } } -- Biotronic