Take advantage of "zero-copy" feature of libarchive
Posted: Sun Jan 28, 2024 1:31 pm
Hi! here's something we could do to optimize the performance when handling archives:
Seems currenly XnView MP just uses archive_read_data_into_fd to read and copy the file data from archive to a temploary file under local\temp folder, to generate thumbnail or to present on the screen.
We could use archive_read_data_block(not archive_read_data, which not suitable for dealing with large files) for obtaining file data instead, to aviod useing the temploary file and reduce the extra overhead of copy.
also this prevents the situation that a large video file in the archive could make xnview hang due to lack of space or slow copy speed.
Seems currenly XnView MP just uses archive_read_data_into_fd to read and copy the file data from archive to a temploary file under local\temp folder, to generate thumbnail or to present on the screen.
We could use archive_read_data_block(not archive_read_data, which not suitable for dealing with large files) for obtaining file data instead, to aviod useing the temploary file and reduce the extra overhead of copy.
also this prevents the situation that a large video file in the archive could make xnview hang due to lack of space or slow copy speed.