Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues for Android about replacing zlib using zstd #501

Closed
296777513 opened this issue Dec 26, 2016 · 6 comments
Closed

Issues for Android about replacing zlib using zstd #501

296777513 opened this issue Dec 26, 2016 · 6 comments
Labels

Comments

@296777513
Copy link

Hi
I am attempting to port zstd to Android libziparchive module, by using zlibWrapper to replace zlib .
As scenes in Androd concerns more about decompress speed, so I test decompressing zip files(like bmp.zip(bmp file compressed by zstd/zlib firstly) and apk) using zlib/zstd.
The data below shows gaining little benefit comparing zlib, do you have any advise for my occuration?
thanks

image

test steps:
1: firstly, compress bmp/txt files into test_zstd.zip using zstd, test_zlib.zip using zlib;
2: secondly, decompress zip files above into memory or file system;
3: calculating time consuming for step 2.

@jinguang-dong
Copy link

Hi Cyan4973,

Please help to analysis and give some suggestion  for the decompress benfit issue.

@terrelln
Copy link
Contributor

terrelln commented Dec 26, 2016

It seems the decompressor is running at about 100 MB/s in your tests.

zstd so far is primarily optimized for x86, so it is expected to be slower on ARM, but that is too slow. I ran the following program on my iPhone 6s and looked at the logging output.

#import "bench.h"

/* ... */

- (void)viewDidLoad {
    ZSTD_compressionParameters params;
    memset(&params, 0, sizeof(params));
    BMK_SetNbSeconds(5);
    BMK_setNotificationLevel(1);
    BMK_setDecodeOnly(0);
    BMK_benchFiles(NULL, 0, NULL, 1, 10, &params);
}
/* ... */

When running on an unoptimized build it decompressed at about 100 MB/s. When running a build optimized with -Os it decompressed at about 800 MB/s. For reference, Apple's zlib implementation decompresses at about 270 MB/s. I know it isn't Android, but I would expect similar relative results on the same architecture.

Is your binary compiled with optimizations?

@jinguang-dong
Copy link

Hi Terrelln,
Thanks for your propose and We will try it.

@powof2
Copy link

powof2 commented Dec 26, 2016

May be it is something about your android system? 64-bits is way faster.
here is another test.

@Cyan4973
Copy link
Contributor

Both advises by @terrelln and @powof2 are relevant :

  • Check compiler optimisation settings
  • Check if your test system is 32 or 64 bits. It makes a substantial difference.

@296777513
Copy link
Author

Hi Cyan4973 and terrelln,
Thanks for your reply, we run a build optimized with -O2 default, and test in 64-bits case.
I see that the file tested may influence the decompress speed, use fullbench and turbobench, 800+M/s when decompressing default 10M sample, while only 450+M/s when decompressing bmp file. Both tested in my linux server.
image
image

Also, for the same test file(10M sample), linux server runs decompressing in 800+M, while my Android 7.0 mobile phone only runs in 450+M(data shows below).
image

So, I think both the test files and my Android platform cause the decomressing speed too slow.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants