Comments (13)
All options are passed to zlib. You can look up the zlib docs separately if you need to know the details. :)
Usually you wouldn't touch those things, they already default to the optimal sweet spot levels on nearly every machine.
from compression.
So I had thought about doing this back at the beginning of 2014, but gave up, because I couldn't just copy Node.js docs, had to read and come up with good explanations of the stuff from the zlib man page, and have to check that those explanations actually match what Node.js is doing.
@ilanbiala if you're willing to do this, I would happily add it/accept a PR :)
from compression.
@dougwilson how explanatory do you think it should be?
from compression.
how explanatory do you think it should be?
Probably just good enough so you don't have to consult any other docs to understand what they mean, since that's what it does right now (points you to read another doc source). So like an explanation that makes sense, the type and range of values the option takes.
from compression.
like this?
https://github.com/kesla/node-snappy/blob/master/benchmark/benchmark.js
level: zlib.Z_BEST_SPEED
memLevel: zlib.Z_MAX_MEMLEVEL
from compression.
Usually you wouldn't touch those things, they already default to the optimal sweet spot levels on nearly every machine.
can I suggest these zlib options as default?
https://gist.github.com/hex7c0/25165f2f4650dfe16832
from compression.
Why would we use those as defaults? Those values are not going to be worth your while. :)
Max speed will be faster, but compress way too little. Max memory is also certainly unnecessary, otherwise it would be the default.
from compression.
@hex7c0 Hmmm, benchmarks look promising though. How big is the file you are transferring?
from compression.
@Fishrock123 I use @kesla's benchmark
so the file is this 46Kb
from http://nodejs.org/api/zlib.html#zlib_memory_usage_tuning
memLevel = 8 (default values)
from http://zlib.net/manual.html#Constants
The memLevel parameter specifies how much memory should be allocated for the internal compression state. memLevel=1 uses minimum memory but is slow and reduces compression ratio; memLevel=9 uses maximum memory for optimal speed. The default value is 8. See zconf.h for total memory usage as a function of windowBits and memLevel.
with zlib.Z_MAX_MEMLEVEL
(maybe) you can raise to 9
from compression.
regard compression/speed
46155 bytes no compression
14105 bytes default compression
16481 bytes zlib.Z_BEST_SPEED compression
there isn't too much difference :) +2376 bytes
from compression.
@Fishrock123 do those settings make sense?
from compression.
If someone wants them documented here, please see #28 (comment) . What I need is a specific list of the options and exactly what they do and what values they accept (and their complete value range).
from compression.
This is an example of what I'm looking for: c5b813e
from compression.
Related Issues (20)
- Setting Vary header although caching is disabled HOT 1
- "drain" event listener leak when using res.once("drain"); can't use res.removeListener("drain") HOT 3
- compresssion doesn't work ,the vue.txt is 2m HOT 2
- Content-Type: application/json; charset=utf-8 No effect HOT 2
- Question: Why this middleware HOT 2
- Corrupted compressed .js-files for Mac OS / Safari -clients HOT 11
- Is compression working when node server is running on a container? HOT 2
- middleware fails when the request has more than 1 values for accept-encoding header HOT 2
- Is compression result cached? HOT 1
- change Transfer-encoding HOT 1
- Why does the data size increase after compression HOT 1
- Force size to be a minimum... HOT 2
- Chunked encoding is broken after using this middleware HOT 1
- Using a current debug version HOT 1
- Deflate backwards HOT 7
- Compression instrumentation (before/after compression hooks) HOT 2
- Angular Not Compressing? HOT 2
- compression not working json payload HOT 6
- Crash when compressing characters like ū HOT 1
- Express returns a non-compliant HTTP/206 response when gzip is enabled HOT 9
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 compression.