VictoriaMetrics/lib/protoparser/common
Aliaksandr Valialkin 6232eaa938
lib/bytesutil: split Resize() into ResizeNoCopy() and ResizeWithCopy() functions
Previously bytesutil.Resize() was copying the original byte slice contents to a newly allocated slice.
This wasted CPU cycles and memory bandwidth in some places, where the original slice contents wasn't needed
after slize resizing. Switch such places to bytesutil.ResizeNoCopy().

Rename the original bytesutil.Resize() function to bytesutil.ResizeWithCopy() for the sake of improved readability.

Additionally, allocate new slice with `make()` instead of `append()`. This guarantees that the capacity of the allocated slice
exactly matches the requested size. The `append()` could return a slice with bigger capacity as an optimization for further `append()` calls.
This could result in excess memory usage when the returned byte slice was cached (for instance, in lib/blockcache).

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2007
2022-01-25 15:28:42 +02:00
..
compress_reader.go app/{vminsert,vmagent}: add ability to ingest data via DataDog "submit metrics" API 2021-09-29 00:12:26 +03:00
extra_labels.go app/{vminsert,vmagent}: allow adding extra labels when importing data via Prometheus, CSV and JSON line formats 2020-09-02 19:47:02 +03:00
lines_reader_test.go app/vmagent: initial implementation for vmagent 2020-02-23 17:31:54 +02:00
lines_reader.go lib/bytesutil: split Resize() into ResizeNoCopy() and ResizeWithCopy() functions 2022-01-25 15:28:42 +02:00
timestamp.go lib/protoparser/common: do not read request body when parsing timestamp query arg 2020-09-11 14:45:21 +03:00
unmarshal_work.go lib/ingestserver: properly close incoming connections during graceful shutdown 2021-05-08 19:53:45 +03:00