In a project with thousands of files and just a few hundreds to update, it would be preferable to have mpqcli handle all the files in a list in one command while the mpq archive is open, rather than (open delete close, open add close) for each file. At that point, re-creating the archive is faster, but wasteful. The -w, --overwrite option suggested in PR #115 would help (-f, --force could be an alias), but wouldn't completely solve the issue for multiple writes.
# Create proj.mpq with a thousand random files
# time 0m0,167s
mkdir proj
for (( i = 0 ; i < 1000 ; i++ )); do
echo $RANDOM > proj/file$i.txt
done
mpqcli create proj
# Update a hundred files in proj.mpq
# time 0m1,078s
for (( i = 0 ; i < 100 ; i++ )); do
echo $RANDOM > proj/file$i.txt
mpqcli remove file$i.txt proj.mpq
mpqcli add proj/file$i.txt proj.mpq
done
Tools like tar cf target.tar file1 file2 ... have the archive first then any number of files after. Another way of doing it would be like mv file1 file2 ... target where the target is always the last argument.
Having a few hundred files would make the command very large too. This could be solved by either:
- using a new option
-l, --list TEXTFILE where each line would be a file path
- enabling recurse in case
mpqcli add points at a directory
I'll see if I can manage to create a patch, but I'm not very familiar with the code and I wanted to have the issue laid out first.
In a project with thousands of files and just a few hundreds to update, it would be preferable to have mpqcli handle all the files in a list in one command while the mpq archive is open, rather than (open delete close, open add close) for each file. At that point, re-creating the archive is faster, but wasteful. The
-w, --overwriteoption suggested in PR #115 would help (-f, --forcecould be an alias), but wouldn't completely solve the issue for multiple writes.Tools like
tar cf target.tar file1 file2 ...have the archive first then any number of files after. Another way of doing it would be likemv file1 file2 ... targetwhere the target is always the last argument.Having a few hundred files would make the command very large too. This could be solved by either:
-l, --list TEXTFILEwhere each line would be a file pathmpqcli addpoints at a directoryI'll see if I can manage to create a patch, but I'm not very familiar with the code and I wanted to have the issue laid out first.