Open
Description
Very self-explanatory, typical write API can be very CPU extensive when writing a small amount in each iteration.
The solution is MemoryMapped Files. most platforms support it.
For JVM, I recommend against using the JDK-provided MappedByteBuffer and implementing it from scratch with JNA/JNR.
MappedByteBuffer cons:
- You cannot unmap at will while it's very possible to do so if you call the native API for that. [This is useful if you want to have a dynamic-sized mapped file, ie take a reasonable-sized chunk, and if it's more than needed you can just unmap and resize internally, JDK 8 implementation doesn't provide any solution for that, but Panama solves it, which is not usable on android]
- Bulk write on Android SDK is missing, so for that you'll have to write JNA either way.