bzip3 compression

Share your advanced PureBasic knowledge/code with the community.
Thorium
Addict
Addict
Posts: 1305
Joined: Sat Aug 15, 2009 6:59 pm

bzip3 compression

Post by Thorium »

bzip3 is a compression algorithm/library which is meant as a successor to bzip2, but from a different developer.

It is lightning fast and can outperform LZMA on very large files in compression ratio. In my tests LZMA has much better compression ratio on small files.
This is probably the best lib for a balanced compression ratio and speed balance.

https://github.com/kspalaiologos/bzip3

I compiled a static lib for Windows and made a PB include to use it in PureBasic.
Download
Thorium
Addict
Addict
Posts: 1305
Joined: Sat Aug 15, 2009 6:59 pm

Re: bzip3 compression

Post by Thorium »

Updated the lib with 2 crash fixes. It's not a new official release but can't have it crash, so i included the fixes and recompiled it.
There is another problem in which compression fails with status ok in a specific case, which should be fixed soon by the author of bzip3.
Fred
Administrator
Administrator
Posts: 18220
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: bzip3 compression

Post by Fred »

It seems to be using the LGPL license which exclude static linking unless you open all your source. Using it as a DLL is fine though.
User avatar
skywalk
Addict
Addict
Posts: 4218
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: bzip3 compression

Post by skywalk »

Thanks, this does look very promising. 8)
FWIW, the LGPL license allows static linking with a catch. Your app must allow end users to upgrade or downgrade any LGPL content. Easy for dlls. With static libs, you have to recompile your source code. So, end users could demand your object files to perform their own compilations.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
skywalk
Addict
Addict
Posts: 4218
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: bzip3 compression

Post by skywalk »

Question, how did you compile on Windows? Using cygwin?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Thorium
Addict
Addict
Posts: 1305
Joined: Sat Aug 15, 2009 6:59 pm

Re: bzip3 compression

Post by Thorium »

skywalk wrote: Tue Aug 20, 2024 10:04 pm Question, how did you compile on Windows? Using cygwin?
I used Visual Studio 2022 and CMake.
I tweaked the settings in the generated project to compile it as a static lib and with full code optimization.
Thorium
Addict
Addict
Posts: 1305
Joined: Sat Aug 15, 2009 6:59 pm

Re: bzip3 compression

Post by Thorium »

Fred wrote: Tue Aug 20, 2024 6:32 pm It seems to be using the LGPL license which exclude static linking unless you open all your source. Using it as a DLL is fine though.
I wasnt that concerned about the license. But if anyone does not want to open their source and needs the DLL, i can compile one, if they can't do it themself, no problem.
Post Reply