#1 2019-04-01 09:45:37

Greg0r
Member
Registered: 2019-01-28
Posts: 49

LZMA/2 compression unit

Hi,

Can you add LZMA compression ?
Could anyone recommend solution without .dll ?
I want LZMA equivalent of

 CompressDeflate(data,true);

Offline

#2 2019-04-01 16:15:43

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: LZMA/2 compression unit

IMHO LZMA is too slow at compressing data for communication, and it could be easily blocked by most proxies, since "Accept-Encoding: lzma" is not supported anywhere (but Opera browser?).

Offline

#3 2019-04-01 17:36:10

Greg0r
Member
Registered: 2019-01-28
Posts: 49

Re: LZMA/2 compression unit

@ab
For JSON txt data: Fast/fastest method it compress text much better than zip/gzip at similar speed or even faster.
(I have tested 7-zip)

Last edited by Greg0r (2019-04-01 17:37:04)

Offline

#4 2019-04-02 15:15:54

Greg0r
Member
Registered: 2019-01-28
Posts: 49

Re: LZMA/2 compression unit

ab wrote:

IMHO LZMA is too slow at compressing data for communication, and it could be easily blocked by most proxies, since "Accept-Encoding: lzma" is not supported anywhere (but Opera browser?).

Sample txt UTF8 file:
Oryginal- 4280KB
LZMA - Fastest 273KB
ZIP - normal - 1291KB
Speed: Both very similar.
I don't see the reason to choose ZIP.
LZMA eats it in every aspect.

Does anyone know good way for strings data LZMA compression/decomp in Delphi?

Last edited by Greg0r (2019-04-02 15:17:44)

Offline

#5 2019-04-02 16:15:33

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: LZMA/2 compression unit

gzip/deflate is used everywhere in the Web, all http clients/servers/proxies support it, So for compatibility reasons this is best choice. In any case most of JSON responses is not so huge (at last should be) to take in account difference between compression rate.

Offline

#6 2019-04-03 14:27:40

Greg0r
Member
Registered: 2019-01-28
Posts: 49

Re: LZMA/2 compression unit

You all guys are right totally but I'm afraid my needs are different I post frequent ~100 kb Jsons with txt data
For me it make difference if server store 50 or 30% of oryginal size.
Also I have noticed that most of even programmers doesn't know about blazing fast LZMA in fastest method compression
I agree that in normal it unusable slow for server purposes.
LZMA normal and fastest are not comparable when comes to speed.
@mpv do you know any good component or way to compress json string with LZMA in Delphi (10.2, 10.3)

Last edited by Greg0r (2019-04-03 14:28:29)

Offline

#7 2019-04-03 20:23:44

greedy
Member
Registered: 2018-10-26
Posts: 11

Re: LZMA/2 compression unit

Maybe you should test brotli or gzip with your json file. Those are also supported in every browser while I guess LZMA cannot be used in any browser.

Offline

#8 2019-04-04 09:59:39

Greg0r
Member
Registered: 2019-01-28
Posts: 49

Re: LZMA/2 compression unit

I dont need browser support, just typical storage compressed data, LZMA fastest could be the best there

Offline

#9 2019-04-04 10:06:58

oz
Member
Registered: 2015-09-02
Posts: 98

Re: LZMA/2 compression unit

Hi,
InnoSetup has built-in support for LZMA file compression using a dll. Have a look at https://github.com/jrsoftware/issrc/blo … s/LZMA.pas
Another option would be to go for translating headers and directly linking the C .obj file.

Offline

#10 2019-04-05 09:36:24

igors233
Member
Registered: 2012-09-10
Posts: 241

Re: LZMA/2 compression unit

> Another option would be to go for translating headers and directly linking the C .obj file.

If standard 7z (uses LZMA/LZMA2) solution is fine then it's much easier to link to 7z COM interface in it's dll.

Offline

#11 2019-04-06 08:49:53

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: LZMA/2 compression unit

Try our SynLizard unit.

It is very efficient and much newer algorithm than lzma.

Offline

Board footer

Powered by FluxBB