-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mmap for library(pio) with partial strings #251
Comments
... which means in the worst case that two pages are needed: The file ends one byte before the next page. |
Just to be sure: phrase_from_file/3 would need to first open the file, mmap it, and scan it for a zero-byte and malformed UTF-8 encodings, reporting them immediately. Further, the number of characters can be determined this way, should this be of use somehow. Note that even in the presence of a zero-byte mmap still can be used, at least for the sequence up to that zero-byte. |
Tiny moral update: mmap faster than syscalls, because it uses AVX-instructions. |
((This is for a later moment after #24 #95 is done))
For UTF-8 files not containing a zero-byte (the majority of files to be parsed),
phrase_from_file(Phrase__0, File)
could avoid incremental copying altogether usingmmap(3)
. The file is mapped at once into a fitting memory area of the heap up to the last page, which is written anew with a terminating zero-byte and a nil at the end.The text was updated successfully, but these errors were encountered: