We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I write test how big enough must be buffer for good compression
void testSize(char *path, int size) { uLong IN_LEN; uLong in_len; uLong out_len; uLong new_len; IN_LEN = size; uint8 *in = (uint8 *)malloc(IN_LEN); out_len = compressBound(IN_LEN); uint8 *out = (uint8 *)malloc(out_len); FILE *fp = fopen(path, "rb"); long sumin = 0; long sumout = 0; while (!feof(fp)) { in_len = fread(in, 1, IN_LEN, fp); sumin += in_len; int cmp_status = compress(out, &out_len, in, in_len); if (cmp_status != Z_OK) { printf("compress() failed dla size=%d %d %d\n", size, in_len, out_len); } sumout += out_len; } fclose(fp); free(in); free(out); printf("size=%d to %d compr=%f\n", size, sumout, (double)sumout / sumin); } void test() { double dsize = 1000; while (dsize < 350000) { testSize("path_to_file_size_380kB", (int)dsize); dsize *= 1.1; } }
Often cmp_status != Z_OK and is very slow for small buffers.
The text was updated successfully, but these errors were encountered:
Was out_len too small:
out_len = compressBound(IN_LEN); int cmp_status = compress(out, &out_len, in, in_len);
slow for small buffers because for small buffer it must init big dictionaries, I think.
Sorry, something went wrong.
No branches or pull requests
I write test how big enough must be buffer for good compression
Often cmp_status != Z_OK and is very slow for small buffers.
The text was updated successfully, but these errors were encountered: