MCPcopy
hub / github.com/klauspost/compress / WithDecoderConcurrency

Function WithDecoderConcurrency

zstd/decoder_options.go:68–83  ·  view source on GitHub ↗

WithDecoderConcurrency sets the number of created decoders. When decoding block with DecodeAll, this will limit the number of possible concurrently running decodes. When decoding streams, this will limit the number of inflight blocks. When decoding streams and setting maximum to 1, no async decoding

(n int)

Source from the content-addressed store, hash-verified

66// By default this will be set to 4 or GOMAXPROCS, whatever is lower.
67// Cannot be changed with ResetWithOptions.
68func WithDecoderConcurrency(n int) DOption {
69 return func(o *decoderOptions) error {
70 if n < 0 {
71 return errors.New("concurrency must be at least 0")
72 }
73 newVal := n
74 if n == 0 {
75 newVal = runtime.GOMAXPROCS(0)
76 }
77 if o.resetOpt && newVal != o.concurrent {
78 return errors.New("WithDecoderConcurrency cannot be changed on Reset")
79 }
80 o.concurrent = newVal
81 return nil
82 }
83}
84
85// WithDecoderMaxMemory allows to set a maximum decoded size for in-memory
86// non-streaming operations or maximum window size for streaming operations.

Callers 15

ReadMethod · 0.92
FuzzDecodeAllFunction · 0.85
FuzzDecoderFunction · 0.85
FuzzEncodingFunction · 0.85
TestDecoder_SmallDictFunction · 0.85
TestEncoder_SmallDictFunction · 0.85
TestDecoder_MoreDictsFunction · 0.85
TestDecoder_MoreDicts2Function · 0.85

Calls

no outgoing calls

Tested by 15

FuzzDecodeAllFunction · 0.68
FuzzDecoderFunction · 0.68
FuzzEncodingFunction · 0.68
TestDecoder_SmallDictFunction · 0.68
TestEncoder_SmallDictFunction · 0.68
TestDecoder_MoreDictsFunction · 0.68
TestDecoder_MoreDicts2Function · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…