myfreeer / chrome-pak-customizer

a simple command-line tool to pack and unpack pak files in chrome or chromium-based browser
MIT License
205 stars 36 forks source link

Using mmap for reading and writing pak files #16

Open myfreeer opened 1 year ago

myfreeer commented 1 year ago

Target: branch 3.x

Description

Currently chrome-pak-customizer reads the whole pak file for unpacking, while allocating all the memory needed of pak file for packing. On early stage of this project hard disk drive (HDD) is widely used, which good at sequential reading or writing while has a slow random access speed, so the tradeoff is to read and write the whole pak file and then operate it in memory. Nowadays solid-state drive (SSD) is taking over, which could have much better random access speed than HDDs, so maybe it is time for making the tradeoff optional, using mmap or MapViewOfFile can create a view of file managed by operating system, so the file is automatically read and written on reading and writing memory, which could save memory or make better performance in some cases.

Proposal

Non-Goals