nushell/crates/nu-protocol/src
Devyn Cairns 28e33587d9
msgpackz: increase default compression level (#13035)
# Description
Increase default compression level for brotli on msgpackz to 3. This has
the best compression time generally. Level 0 and 1 give weird results
and sometimes cause extremely inflated outputs rather than being
compressed. So far this hasn't really been a problem for the plugin
registry file, but has been for other data.

The `$example` is the web-app example from https://json.org/example.html

Benchmarked with:

```nushell
seq 0 11 | each { |level|
  let compressed = ($example | to msgpackz --quality $level)
  let time = (timeit { $example | to msgpackz --quality $level })
  {
    level: $level
    time: $time
    length: ($compressed | bytes length)
    ratio: (($uncompressed_length | into float) / ($compressed | bytes length))
  }
}
```

```
╭────┬───────┬─────────────────┬────────┬───────╮
│  # │ level │      time       │ length │ ratio │
├────┼───────┼─────────────────┼────────┼───────┤
│  0 │     0 │ 4ms 611µs 875ns │   3333 │  0.72 │
│  1 │     1 │ 1ms 334µs 500ns │   3333 │  0.72 │
│  2 │     2 │     190µs 333ns │   1185 │  2.02 │
│  3 │     3 │      184µs 42ns │   1128 │  2.12 │
│  4 │     4 │      245µs 83ns │   1098 │  2.18 │
│  5 │     5 │     265µs 584ns │   1040 │  2.30 │
│  6 │     6 │     270µs 792ns │   1040 │  2.30 │
│  7 │     7 │     444µs 708ns │   1040 │  2.30 │
│  8 │     8 │       1ms 801µs │   1040 │  2.30 │
│  9 │     9 │     843µs 875ns │   1037 │  2.31 │
│ 10 │    10 │ 4ms 128µs 375ns │    984 │  2.43 │
│ 11 │    11 │ 6ms 352µs 834ns │    986 │  2.43 │
╰────┴───────┴─────────────────┴────────┴───────╯
```

cc @maxim-uvarov
2024-06-04 17:19:10 -07:00
..
ast Add Span merging functions (#12511) 2024-05-16 22:34:49 +00:00
config Fix typo (#12752) 2024-05-03 16:14:13 -05:00
debugger Fix leftover wrong column name (#12937) 2024-05-22 21:24:22 +00:00
engine Revert "Remove std::env::set_current_dir() call from EngineState::merge_env()" (#12954) 2024-05-24 11:09:59 -05:00
errors Fix panic when redirecting nothing (#12970) 2024-05-27 10:03:06 +08:00
pipeline Allow byte streams with unknown type to be compatiable with binary (#12959) 2024-05-24 17:54:38 -07:00
plugin msgpackz: increase default compression level (#13035) 2024-06-04 17:19:10 -07:00
process Replace ExternalStream with new ByteStream type (#12774) 2024-05-16 07:11:18 -07:00
value Shrink Value by boxing Range/Closure (#12784) 2024-05-09 08:10:58 +08:00
alias.rs Use CommandType in more places (#12832) 2024-05-18 23:37:31 +00:00
did_you_mean.rs Improve case insensitivity consistency (#10884) 2023-11-08 23:58:54 +01:00
eval_base.rs ListStream touchup (#12524) 2024-05-05 16:00:59 +00:00
eval_const.rs Replace ExternalStream with new ByteStream type (#12774) 2024-05-16 07:11:18 -07:00
example.rs Overhaul the plugin cache file with a new msgpack+brotli format (#12579) 2024-04-21 07:36:26 -05:00
id.rs Add virtual path abstraction layer (#9245) 2023-05-23 23:48:50 +03:00
lev_distance.rs Rework for new clippy lints (#12736) 2024-05-02 19:29:03 +02:00
lib.rs Replace ExternalStream with new ByteStream type (#12774) 2024-05-16 07:11:18 -07:00
module.rs Error on use path item1 item2, if item1 is not a module (#11183) 2023-12-05 11:38:45 +01:00
signature.rs Use CommandType in more places (#12832) 2024-05-18 23:37:31 +00:00
span.rs Add Span merging functions (#12511) 2024-05-16 22:34:49 +00:00
syntax_shape.rs open, rm, umv, cp, rm and du: Don't globs if inputs are variables or string interpolation (#11886) 2024-02-23 09:17:09 +08:00
ty.rs Shrink the size of Expr (#12610) 2024-04-24 15:46:35 +00:00