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.
Take advantage of "zero-copy" feature of libarchive
Moderators: helmut, XnTriq, xnview
Re: Take advantage of "zero-copy" feature of libarchive
ok, thanks. but the use archive_read_data_block will not change the use of temporary file
Pierre.
Re: Take advantage of "zero-copy" feature of libarchive
Thanks for reply, unlike archive_read_data_into_fd, archive_read_data_block would just read the file data into the memory(even just a file mapping to the block of the original archive file if the archive is not using any algorithm for compression, like you choose store method for zip archive) instead of write the file data to the file on the disk. Is it necessary for XnView MP to create a temploary file for reading instead of just read the file from the memory?xnview wrote: Thu Feb 01, 2024 8:22 am ok, thanks. but the use archive_read_data_block will not change the use of temporary file
Re: Take advantage of "zero-copy" feature of libarchive
temporary file is neededDenuvo wrote: Fri Feb 02, 2024 5:21 pm Is it necessary for XnView MP to create a temploary file for reading instead of just read the file from the memory?
Pierre.