Skip to content
New issue

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

feat(perMessageDeflate): Allow 'level' option #1199

Merged
merged 1 commit into from Sep 7, 2017

Conversation

STRML
Copy link
Contributor

@STRML STRML commented Sep 5, 2017

This corresponds to the zlib level as described
in https://nodejs.org/api/zlib.html#zlib_class_zlib_deflateraw

This could be used, along with threshold to tune CPU usage and size. The default level in zlib is 6, which could be too high, but some users may find that 1 is worth the CPU savings for a quick pass.

For example, on some JSON sample data:

Running zlib.deflateRawSync for 1000 iterations.
Uncompressed Data Size: 137063 bytes

-----

Level 0: 550.879ms
Size: 137083 bytes
Level 1: 836.332ms
Size: 11379 bytes
Level 2: 825.474ms
Size: 10717 bytes
Level 3: 847.320ms
Size: 10397 bytes
Level 4: 1187.744ms
Size: 8388 bytes
Level 5: 1286.184ms
Size: 7761 bytes
Level 6: 1489.151ms
Size: 7372 bytes
Level 7: 1657.936ms
Size: 7301 bytes
Level 8: 1828.456ms
Size: 7187 bytes
Level 9: 1896.402ms
Size: 7181 bytes

@lpinca
Copy link
Member

lpinca commented Sep 7, 2017

@STRML can you please add a line to https://github.com/websockets/ws/blob/master/doc/ws.md for this new option?

@STRML
Copy link
Contributor Author

STRML commented Sep 7, 2017

Sure, added.

@lpinca lpinca merged commit 80445e7 into websockets:master Sep 7, 2017
@lpinca
Copy link
Member

lpinca commented Sep 7, 2017

Thank you. Will cut a new release next week when I'm back home.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants