Author Topic: bzip3  (Read 528 times)

Vortex

  • Member
  • *****
  • Posts: 2768
bzip3
« on: January 30, 2023, 04:23:49 AM »
Quote
A better, faster and stronger spiritual successor to BZip2. Features higher compression ratios and better performance thanks to a order-0 context mixing entropy coder, a fast Burrows-Wheeler transform code making use of suffix arrays and a RLE with Lempel Ziv+Prediction pass based on LZ77-style string matching and PPM-style context modeling.

Like its ancestor, BZip3 excels at compressing text or code.

https://github.com/kspalaiologos/bzip3

Gunther

  • Member
  • *****
  • Posts: 4178
  • Forgive your enemies, but never forget their names
Re: bzip3
« Reply #1 on: January 30, 2023, 06:29:03 AM »
Thank you for the link, Erol.  :thumbsup: Are there any advantages over 7zip?
You have to know the facts before you can distort them.

Vortex

  • Member
  • *****
  • Posts: 2768
Re: bzip3
« Reply #2 on: January 30, 2023, 06:36:23 AM »
Hi Gunther,

7-Zip is an archiver and can pack multiple files while the bzip family can process only one file at one time.

Gunther

  • Member
  • *****
  • Posts: 4178
  • Forgive your enemies, but never forget their names
Re: bzip3
« Reply #3 on: January 30, 2023, 07:06:21 AM »
Erol,

7-Zip is an archiver and can pack multiple files while the bzip family can process only one file at one time.

thank you for the quick reply. I will have a look at the C sources anyway - as soon as I find time.
You have to know the facts before you can distort them.

jj2007

  • Member
  • *****
  • Posts: 13871
  • Assembly is fun ;-)
    • MasmBasic
Re: bzip3
« Reply #4 on: January 30, 2023, 09:12:13 AM »
Hi Erol,

I made a quick test using the binary found here.
bzip3    compressed a 2.7MB source to  368,764 bytes
FreeArc compressed the same source to 373,802 bytes

So far, so good. But bzip3 took 630 milliseconds, while FreeArc needed only 422 milliseconds to do the job.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10572
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: bzip3
« Reply #5 on: January 30, 2023, 10:31:56 AM »
Had a quick play, file size reduction of win64.inc went from 786888 down to 108846 bytes.

Setting the thread count increases the speed of compression. On this old 6 core, --j 12 made it fast. Tested on an 800 meg video file.

Better compression than any option in Winrar.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

mineiro

  • Member
  • ****
  • Posts: 921
Re: bzip3
« Reply #6 on: January 31, 2023, 04:15:55 AM »
Some encode.su forum members have already won the hutter prize.
Following the same dilemma, speed or better compression?

You can use wrt44.zip (preprocessor) with bzip3.
Zpaq has good speed but lower compression.
paq (Matt Mahoney) series has good compression but lower speed.

http://mattmahoney.net/dc/
http://mattmahoney.net/dc/paq.html

$./paq8l -1 win64.inc
78215 bytes, Time 6.55 sec, used 38862968 bytes of memory
$./paq8l -8 win64.inc
61151 bytes, Time 44.14 sec, used 1643021320 bytes of memory

There are some versions of paq containing dictionaries that can compress more. We can create our own dictionary. Some mixing contents done to jpg,bmp,wav,... .
Jpeg used huffman in past because patents, now I see persons using arithmetic coding instead. Probably old mpeg,jpeg files can be compressed.
I'd rather be this ambulant metamorphosis than to have that old opinion about everything

jj2007

  • Member
  • *****
  • Posts: 13871
  • Assembly is fun ;-)
    • MasmBasic
Re: bzip3
« Reply #7 on: January 31, 2023, 05:25:54 AM »
I made more tests. With option -m9, FreeArc has much better compression and is still significantly faster.

Vortex

  • Member
  • *****
  • Posts: 2768
Re: bzip3
« Reply #8 on: January 31, 2023, 06:36:14 AM »
Hi Jochen,

Those versions compiled for Windows XP are outdated. You can get the latest release from here:

https://github.com/kspalaiologos/bzip3/releases

Vortex

  • Member
  • *****
  • Posts: 2768
Re: bzip3
« Reply #9 on: January 31, 2023, 06:56:47 AM »
The MSYS2 development system is providing a ready package for bzip3 :

Code: [Select]
# pacman -S mingw-w64-x86_64-bzip3
resolving dependencies...
looking for conflicting packages...

Packages (1) mingw-w64-x86_64-bzip3-1.2.2-1

Total Download Size:   0.16 MiB
Total Installed Size:  0.52 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
 mingw-w64-x86_64-bzip3-1.2...   159.6 KiB  93.8 KiB/s 00:02 [###############################] 100%
.
.
:: Processing package changes...
(1/1) installing mingw-w64-x86_64-bzip3                      [###############################] 100%

Dependencies :

Code: [Select]
# ldd /mingw64/bin/bzip3.exe
        ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x77970000)
        kernel32.dll => /c/Windows/system32/kernel32.dll (0x77850000)
        KERNELBASE.dll => /c/Windows/system32/KERNELBASE.dll (0x7fefd810000)
        libbzip3-0.dll => /mingw64/bin/libbzip3-0.dll (0x7fefa540000)
        msvcrt.dll => /c/Windows/system32/msvcrt.dll (0x7fefecb0000)
        libwinpthread-1.dll => /mingw64/bin/libwinpthread-1.dll (0x7fefb0a0000)

Vortex

  • Member
  • *****
  • Posts: 2768
Re: bzip3
« Reply #10 on: January 31, 2023, 07:09:20 AM »
Building a static binary with less dependencies :

https://github.com/kspalaiologos/bzip3/blob/master/PORTING.md

64-bit :

Code: [Select]
./configure CC=x86_64-w64-mingw32-gcc --host x86_64-w64-mingw32 --enable-static-exe

make

Dependencies :

Code: [Select]
# ldd ./bzip3.exe
        ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x77970000)
        kernel32.dll => /c/Windows/system32/kernel32.dll (0x77850000)
        KERNELBASE.dll => /c/Windows/system32/KERNELBASE.dll (0x7fefd810000)
        msvcrt.dll => /c/Windows/system32/msvcrt.dll (0x7fefecb0000)

32-bit :

Code: [Select]
./configure CC=i686-w64-mingw32 --host i686-w64-mingw32 --enable-static-exe

make

Dependencies :

Code: [Select]
# ldd ./bzip3.exe
        ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x77970000)
        ntdll.dll => /c/Windows/SysWOW64/ntdll.dll (0x77b30000)
        wow64.dll => /c/Windows/SYSTEM32/wow64.dll (0x74e80000)
        wow64win.dll => /c/Windows/SYSTEM32/wow64win.dll (0x74e20000)
        wow64cpu.dll => /c/Windows/SYSTEM32/wow64cpu.dll (0x74e10000)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10572
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: bzip3
« Reply #11 on: January 31, 2023, 08:47:22 AM »
Apart from testing the pre-built binaries which work OK, is there a 64 bit COFF library module that can be linked into a 64 bit app ?
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

jj2007

  • Member
  • *****
  • Posts: 13871
  • Assembly is fun ;-)
    • MasmBasic
Re: bzip3
« Reply #12 on: January 31, 2023, 09:41:53 AM »
Hi Jochen,

Those versions compiled for Windows XP are outdated. You can get the latest release from here:

https://github.com/kspalaiologos/bzip3/releases

Hi Erol,

There are a dozen archives, each with a dozen strange files. I won't download them all, but if you know which one has a functioning executable, please let me know. I found one functioning executable so far, not on that site (see above), and its performance was really disappointing, especially given the hype that I see on GitHub.

Had a quick play, file size reduction of win64.inc went from 786888 down to 108846 bytes.

Quote
136 ms for decompressing with bzip3

FreeArc 0.666 extracting archive: w64.arc
Extracted 1 file, 96,807 => 752,296 bytes. Ratio 12.8%
Extraction time: cpu 0.02 secs, real 0.02 secs. Speed 37,615 kB/s
All OK
120 ms for decompressing with FreeArc

See attachment. FreeArc is here.

TimoVJL

  • Member
  • *****
  • Posts: 1296
Re: bzip3
« Reply #13 on: January 31, 2023, 07:34:10 PM »
Apart from testing the pre-built binaries which work OK, is there a 64 bit COFF library module that can be linked into a 64 bit app ?
here are msvc 2022 compiled obj-files for testing.
May the source be with you

jj2007

  • Member
  • *****
  • Posts: 13871
  • Assembly is fun ;-)
    • MasmBasic
Re: bzip3
« Reply #14 on: January 31, 2023, 08:06:12 PM »
Nice, Timo :thumbsup:

Now all we need is a bit of documentation :biggrin: