p7zip-project / p7zip

A new p7zip fork with additional codecs and improvements (forked from https://sourceforge.net/projects/sevenzip/ AND https://sourceforge.net/projects/p7zip/).
765 stars 109 forks source link

it seems -mmt option not work #90

Closed l1t1 closed 3 years ago

l1t1 commented 3 years ago

time ./7za a -m0=FLZMA2 7b.7z /tmp/z.tar

7-Zip (a) [64] 17.02 : Copyright (c) 1999-2020 Igor Pavlov : 2017-08-28 p7zip Version 17.02 (locale=en_US.utf8,Utf16=on,HugeFiles=on,64 bits,16 CPUs x64)

Scanning the drive: 1 file, 17643520 bytes (17 MiB)

Creating archive: 7b.7z

Items to compress: 1

Files read from disk: 1 Archive size: 4439670 bytes (4336 KiB) Everything is Ok

real 0m29.067s user 0m8.021s sys 0m0.192s

time ./7za a -m0=FLZMA2 -mmt=4 7c.7z /tmp/z.tar

7-Zip (a) [64] 17.02 : Copyright (c) 1999-2020 Igor Pavlov : 2017-08-28 p7zip Version 17.02 (locale=en_US.utf8,Utf16=on,HugeFiles=on,64 bits,16 CPUs x64)

Scanning the drive: 1 file, 17643520 bytes (17 MiB)

Creating archive: 7c.7z

Items to compress: 1

Files read from disk: 1 Archive size: 4439670 bytes (4336 KiB) Everything is Ok

real 0m29.261s user 0m8.060s sys 0m0.201s

jinfeihan57 commented 3 years ago

Which branch are you using?

l1t1 commented 3 years ago

i am using https://codeload.github.com/szcnick/p7zip/tar.gz/v17.02

jinfeihan57 commented 3 years ago

Can you try the latest dev branch?

l1t1 commented 3 years ago

it works fine in default, without set -mmt, and the size is a little bigger

[ p7zip-dev]# make -j -s  CC="gcc -std=c11"
../../../../C/Alloc.c: In function ‘VirtualAlloc’:
../../../../C/Alloc.c:133:9: warning: implicit declaration of function ‘mkstemp’ [-Wimplicit-function-declaration]
         fd = mkstemp(tempname);
         ^
../../../../C/Alloc.c: In function ‘largePageMinimum’:
../../../../C/Alloc.c:262:3: warning: implicit declaration of function ‘getpagesize’ [-Wimplicit-function-declaration]
   if (g_HugetlbPath == NULL || (size = pathconf(g_HugetlbPath, _PC_REC_MIN_XFER_SIZE)) <= getpagesize())
   ^

[bin]# time ./7za a -t7z  -m0=flzma2 dzm7c.txt.7z /tmp/p7zip-17.02/bin/dzm7.txt

7-Zip (a) [64] 17.02 : Copyright (c) 1999-2020 Igor Pavlov : 2017-08-28
p7zip Version 17.02 (locale=en_US.utf8,Utf16=on,HugeFiles=on,64 bits,16 CPUs x64)

Open archive: dzm7c.txt.7z
--
Path = dzm7c.txt.7z
Type = 7z
Physical Size = 32
Headers Size = 0
Solid = -
Blocks = 0

Scanning the drive:
1 file, 46129961 bytes (44 MiB)

Updating archive: dzm7c.txt.7z

Items to compress: 1

Files read from disk: 1
Archive size: 4871089 bytes (4757 KiB)
Everything is Ok

real    0m5.344s
user    0m11.487s
sys     0m0.109s
[bin]# ./7za l  -m0=flzma2 dzm7c.txt.7z

7-Zip (a) [64] 17.02 : Copyright (c) 1999-2020 Igor Pavlov : 2017-08-28
p7zip Version 17.02 (locale=en_US.utf8,Utf16=on,HugeFiles=on,64 bits,16 CPUs x64)

Scanning the drive for archives:
1 file, 4871089 bytes (4757 KiB)

Listing archive: dzm7c.txt.7z

--
Path = dzm7c.txt.7z
Type = 7z
Physical Size = 4871089
Headers Size = 122
Method = LZMA2:24
Solid = -
Blocks = 1

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2020-08-22 00:15:45 ....A     46129961      4870967  dzm7.txt
------------------- ----- ------------ ------------  ------------------------
2020-08-22 00:15:45           46129961      4870967  1 files

[bin]# time ./7za a -t7z  -m0=lzma2 dzm7c.txt.7z /tmp/p7zip-17.02/bin/dzm7.txt

7-Zip (a) [64] 17.02 : Copyright (c) 1999-2020 Igor Pavlov : 2017-08-28
p7zip Version 17.02 (locale=en_US.utf8,Utf16=on,HugeFiles=on,64 bits,16 CPUs x64)

Open archive: dzm7c.txt.7z
--
Path = dzm7c.txt.7z
Type = 7z
Physical Size = 4871089
Headers Size = 122
Method = LZMA2:24
Solid = -
Blocks = 1

Scanning the drive:
1 file, 46129961 bytes (44 MiB)

Updating archive: dzm7c.txt.7z

Items to compress: 1

Files read from disk: 1
Archive size: 4755009 bytes (4644 KiB)
Everything is Ok

real    2m8.269s
user    0m35.812s
sys     0m0.326s
l1t1 commented 3 years ago

if i set mmt4, it's slower and size is smaller

[bin]# time ./7za a -t7z -mx5 -m0=flzma2 dzm7c.txt.7z /tmp/p7zip-17.02/bin/dzm7.txt

7-Zip (a) [64] 17.02 : Copyright (c) 1999-2020 Igor Pavlov : 2017-08-28
p7zip Version 17.02 (locale=en_US.utf8,Utf16=on,HugeFiles=on,64 bits,16 CPUs x64)

Open archive: dzm7c.txt.7z
--
Path = dzm7c.txt.7z
Type = 7z
Physical Size = 4755009
Headers Size = 122
Method = LZMA2:24
Solid = -
Blocks = 1

Scanning the drive:
1 file, 46129961 bytes (44 MiB)

Updating archive: dzm7c.txt.7z

Items to compress: 1

Files read from disk: 1
Archive size: 4871089 bytes (4757 KiB)
Everything is Ok

real    0m5.577s
user    0m11.455s
sys     0m0.117s
[bin]# time ./7za a -t7z -mx6 -m0=flzma2 dzm7c.txt.7z /tmp/p7zip-17.02/bin/dzm7.txt

7-Zip (a) [64] 17.02 : Copyright (c) 1999-2020 Igor Pavlov : 2017-08-28
p7zip Version 17.02 (locale=en_US.utf8,Utf16=on,HugeFiles=on,64 bits,16 CPUs x64)

Open archive: dzm7c.txt.7z
--
Path = dzm7c.txt.7z
Type = 7z
Physical Size = 4871089
Headers Size = 122
Method = LZMA2:24
Solid = -
Blocks = 1

Scanning the drive:
1 file, 46129961 bytes (44 MiB)

Updating archive: dzm7c.txt.7z

Items to compress: 1

Files read from disk: 1
Archive size: 4838733 bytes (4726 KiB)
Everything is Ok

real    0m6.266s
user    0m12.194s
sys     0m0.164s
[ bin]# time ./7za a -t7z -mx6 -m0=flzma2 -mmt4 dzm7c.txt.7z /tmp/p7zip-17.02/bin/dzm7.txt

7-Zip (a) [64] 17.02 : Copyright (c) 1999-2020 Igor Pavlov : 2017-08-28
p7zip Version 17.02 (locale=en_US.utf8,Utf16=on,HugeFiles=on,64 bits,16 CPUs x64)

Open archive: dzm7c.txt.7z
--
Path = dzm7c.txt.7z
Type = 7z
Physical Size = 4838733
Headers Size = 122
Method = LZMA2:25
Solid = -
Blocks = 1

Scanning the drive:
1 file, 46129961 bytes (44 MiB)

Updating archive: dzm7c.txt.7z

Items to compress: 1

Files read from disk: 1
Archive size: 4814604 bytes (4702 KiB)
Everything is Ok

real    0m19.454s
user    0m12.195s
sys     0m0.145s
jinfeihan57 commented 3 years ago

By default, multi-threading is enabled. The default number of threads is twice the number of CPU cores. 4 threads must be less than the default number of threads .