Giter Site home page Giter Site logo

Document zlib options about compression HOT 13 CLOSED

expressjs avatar expressjs commented on April 24, 2024
Document zlib options

from compression.

Comments (13)

Fishrock123 avatar Fishrock123 commented on April 24, 2024

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.

dougwilson avatar dougwilson commented on April 24, 2024

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.

ilanbiala avatar ilanbiala commented on April 24, 2024

@dougwilson how explanatory do you think it should be?

from compression.

dougwilson avatar dougwilson commented on April 24, 2024

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.

hex7c0 avatar hex7c0 commented on April 24, 2024

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.

hex7c0 avatar hex7c0 commented on April 24, 2024

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.

Fishrock123 avatar Fishrock123 commented on April 24, 2024

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.

Fishrock123 avatar Fishrock123 commented on April 24, 2024

@hex7c0 Hmmm, benchmarks look promising though. How big is the file you are transferring?

from compression.

hex7c0 avatar hex7c0 commented on April 24, 2024

@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.

hex7c0 avatar hex7c0 commented on April 24, 2024

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.

ilanbiala avatar ilanbiala commented on April 24, 2024

@Fishrock123 do those settings make sense?

from compression.

dougwilson avatar dougwilson commented on April 24, 2024

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.

dougwilson avatar dougwilson commented on April 24, 2024

This is an example of what I'm looking for: c5b813e

from compression.

Related Issues (20)

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.