VictoriaMetrics/lib/mergeset
Aliaksandr Valialkin f4989edd96
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:24:44 +02:00
..
block_header.go lib/{mergeset,storage}: do not use pools for indexBlock and inmemoryBlock during their caching, since this results in higher memory usage in production without any performance gains 2021-02-21 21:18:59 +02:00
block_stream_reader.go lib/bytesutil: split Resize() into ResizeNoCopy() and ResizeWithCopy() functions 2022-01-25 15:24:44 +02:00
block_stream_reader_test.go lib/mergeset: reduce memory usage for inmemoryBlock by using more compact items representation 2021-02-21 22:06:47 +02:00
block_stream_writer.go all: use %w instead of %s for wrapping errors in fmt.Errorf 2020-06-30 23:05:11 +03:00
encoding.go lib/bytesutil: split Resize() into ResizeNoCopy() and ResizeWithCopy() functions 2022-01-25 15:24:44 +02:00
encoding_test.go lib/mergeset: reduce memory usage for inmemoryBlock by using more compact items representation 2021-02-21 22:06:47 +02:00
encoding_timing_test.go all: open-sourcing single-node version 2019-05-23 00:18:06 +03:00
inmemory_part.go lib/{mergeset,storage}: switch from sync.Pool to chan-based pool for inmemoryPart objects 2021-07-06 16:28:41 +03:00
merge.go lib/mergeset: reduce memory usage for inmemoryBlock by using more compact items representation 2021-02-21 22:06:47 +02:00
merge_test.go lib/mergeset: reduce memory usage for inmemoryBlock by using more compact items representation 2021-02-21 22:06:47 +02:00
metaindex_row.go lib: dump compressed block contents on error during decompression 2020-08-15 14:44:33 +03:00
part.go lib/mergeset: tune caches size limits for indexdb/dataBlocks and indexdb/indexBlocks 2022-01-21 12:45:43 +02:00
part_header.go all: use %w instead of %s for wrapping errors in fmt.Errorf 2020-06-30 23:05:11 +03:00
part_search.go lib/bytesutil: split Resize() into ResizeNoCopy() and ResizeWithCopy() functions 2022-01-25 15:24:44 +02:00
part_search_test.go lib/mergeset: unconditionally cache indexdb blocks 2021-02-09 00:47:50 +02:00
table.go lib/{mergeset,storage}: properly limit cache sizes for indexdb 2022-01-20 18:37:17 +02:00
table_search.go lib/mergeset: unconditionally cache indexdb blocks 2021-02-09 00:47:50 +02:00
table_search_test.go lib/mergeset: unconditionally cache indexdb blocks 2021-02-09 00:47:50 +02:00
table_search_timing_test.go lib/mergeset: reduce memory usage for inmemoryBlock by using more compact items representation 2021-02-21 22:06:47 +02:00
table_test.go lib/mergeset: reduce memory usage for inmemoryBlock by using more compact items representation 2021-02-21 22:06:47 +02:00