As I am writing a lexer, I want to avoid as much as possible allocations, so I start by getting the file size to allocate a bunch of tokens based on a heuristic. By doing that I asking my self if the Windows kernel can get the file size with GetFileSizeEx without reading it completely, which will add a latency before I will be able to start lexing?
Does the filesystem starting to fill memory cache immediately when a file handle is open? Because GetFileSizeEx need an open file.
And after I am considering to read my file asynchronously with ReadFileScatter or ReadFileEx. But I can't figure out what is the real difference between those functions, as ReadFileEx can be used with double-buffering to be able to lex a chunk while the next one is filled in background.
ReadFileScatter seems to be a bit more complicated to use as chunks have to be pre-allocated since the beginning with memory aligned to system pages. Does someone know why it is so?
What about FileMapping functions, can it be interesting for my purpose?
PS: Files will stay open during the entire application life.
Aucun commentaire:
Enregistrer un commentaire