Am Tue, 08 Aug 2017 20:48:39 +0000
schrieb Nordlöw <per.nord...@gmail.com>:

> Has anybody written a wrapper around `std.file.readText` (or 
> similar) that appends a final zero-byte terminator in order to 
> realize sentinel-based search in textual parsers.

What do you mean by similar? There are many ways to load a file
into memory before appending \0. In fast.json I used a memory
mapped file. On some OSs you can read past the end of such
mappings safely to generate extra \0 bytes. 16 zero-bytes is a
good amount if you want to use the SSE4.2 string instruction.

https://github.com/mleise/fast/blob/master/source/fast/json.d#L1464

-- 
Marco

Reply via email to