Giter Site home page Giter Site logo

Comments (7)

gildor2 avatar gildor2 commented on May 25, 2024 1

Hi. There's no special compiler flags for it. I simply use "optimize by speed" (-O2), so I think it matches your case.

from fast_zlib.

gildor2 avatar gildor2 commented on May 25, 2024 1

Yes. That guy offers increasing hash table size. This might help, might not. If current hash table size is enough, then increasing it further will not speed up much, and in some cases even could slow-down (when code for maintaining large hash table will take too much time). Just imagine: you're compressing 10Kb file, and using 64k x 8 bytes (64k pointers) hash table for that.

Also that guy made a few mistakes., One of them is assumption that hash has 256 only items - this is true only for compression level 1, which is nearly no compression at all. For compression level 9, hash table uses 16 bits.

from fast_zlib.

photopea avatar photopea commented on May 25, 2024 1

You are right. I think I mixed it up with decompression, where ZLIB uses two 8-bit hash tables (two level hashing).

Also, I thought ZLIB can always run inside 64 kB of RAM, which would not be true in case of 16 hash bits.

from fast_zlib.

yamaken93 avatar yamaken93 commented on May 25, 2024

@gildor2 thanks.
Another subject: did you saw this madler/zlib#360?

from fast_zlib.

yamaken93 avatar yamaken93 commented on May 25, 2024

@gildor2 thanks for the answers. You can close this issue.

from fast_zlib.

photopea avatar photopea commented on May 25, 2024

@gildor2 There is no 64k x 8 bytes There is 32k x 2 bytes (64k bytes in total). DEFLATE can "refer backwards" only up to 32k bytes, and you need only 2-byte pointers to index it.

Also, ZLIB uses only 256-item table when tracking the string occurences, as it has 8-bit hashes.

from fast_zlib.

gildor2 avatar gildor2 commented on May 25, 2024

@gildor2 There is no 64k x 8 bytes There is 32k x 2 bytes (64k bytes in total). DEFLATE can "refer backwards" only up to 32k bytes, and you need only 2-byte pointers to index it.

Yes, my mistake. Perhaps I talked about "generic" hash table - I don't remember.

Also, ZLIB uses only 256-item table when tracking the string occurences, as it has 8-bit hashes.
deflateInit2_ has the following code:

    s->hash_bits = (uInt)memLevel + 7;
    s->hash_size = 1 << s->hash_bits;

memLevel is initialized with DEF_MEM_LEVEL which is 8, so hash has 15 bits, not 8.

from fast_zlib.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.