mio icon indicating copy to clipboard operation
mio copied to clipboard

Consider removing the file size check on mmap as it is redundant in most cases

Open yhyu13 opened this issue 5 months ago • 0 comments

Hi,

I believe it's quite redundant for mmap for check file boundaries as in most use cases, mmap offset and length is bounded by user already.

It should totally up to the user to make sure boundary is met.

So the below query file size can be removed.

https://github.com/vimpunk/mio/blob/8b6b7d878c89e81614d05edca7936de41ccdd2da/include/mio/detail/mmap.ipp#L336

I am working a request that open a gigabytes file in read only mode into thousands of small fragments (~4MB each) , if using mio, it would query the file size thousands of times for nothing.

The boost v1.83.0 mapped_region (which does similar thing to mio) has skipped file size check and simply mapped the file

yhyu13 avatar Feb 29 '24 07:02 yhyu13