Comments (1)
So the main point where the current implementation (outside of RLE mode) spends much time (according to operf) is the comparison after loading the next value from the hash chain in the matching function:
https://github.com/oyvindln/deflate-rs/blob/dd923fb9950b6fce37cec9ed6ab617a036c559b8/src/matching.rs#L103
Maybe this is the cpu stalling waiting for data or something.
Current plans for improvements that may or may not help:
- Avoid creating an the extra temporary huffman code length table.
- Avoid using a temporary heap buffer in in_place_lengths.
- Change the match function to behave more like miniz:
- divide max iterations by 3, do 3 checks per iteration, jump to next iteration on a match
- This didn't seem to make any difference to performance
- divide max iterations by 3, do 3 checks per iteration, jump to next iteration on a match
- Implement a longest_match function using this algorithm to possibly cut down on hash chain iterations:http://www.gildor.org/en/projects/zlib
- Avoid bounds checks in various functions (huffman table length/distance lookups, hash chain, huffman length generation and others)
- Check for faster CRC generators (current used library seems to be abandoned/inactive with some PRs with improvements)
- Consider using threads for some operations
- Avoid buffering input when it's not needed (e.g for the simple functions (deflate_*) and if write_all is called with a very long buffer.)
- Specialisation is unstable, so we might want to make a VecEncoder or something similar instead for now
- Avoid buffering output when using a writer where writing is "guaranteed"(excluding OOM) to succeed, e.g Vec.
- Try to heap-allocate buffers close together in memory. Don't think it's currently doable in an easy way in current stable rust without blowing up the stack (box syntax is unstable, but even that may not work in debug mode).
from deflate-rs.
Related Issues (20)
- Proper writer behaviour
- Hash chains are not updated correctly in some cases. HOT 1
- deepin linux build error HOT 8
- Assertion error from fuzzing HOT 1
- debug assertion fails in writer.rs HOT 18
- Follow API guidelines
- dictionary support
- Port fast mode from miniz
- libflate link in README is broken HOT 1
- Panic on mips64 / mips64el HOT 4
- Remove the flate2 dev-dependency HOT 4
- Panic in `ChainedHashTable::add_hash_value` when encoding HOT 2
- Remove use of deprecated mem::uninitialized HOT 1
- AFL crash HOT 3
- More AFL crashes HOT 3
- Internal assertion fails at images larger than 4800×4800 HOT 6
- Readme claims no unsafe but there is one HOT 1
- Flushing `ZlibEncoder` loops infinitely on some writers HOT 2
- v0.8.5 generates invalid PNGs HOT 7
- Is this project only for deflate usage? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deflate-rs.