Skip to content

v1.4.0.241130

Choose a tag to compare

@fufuok fufuok released this 30 Nov 15:59
· 6 commits to master since this release

💫 BytesPool

Reuse used byte slices to achieve zero allocation.

The existing byte slices are stored in groups according to the capacity length range, and suitable byte slice objects are automatically allocated according to the capacity length when used.

✨ Features

  • Customize the capacity range, or use the default pool.
  • Get byte slices always succeed without panic.
  • Optional length of 0 or fixed-length byte slices.
  • Automatic garbage collection of big-byte slices.
  • [BufPool] implements the httputil.BufferPool interface.
  • [Buffer] similar to bytes.Buffer, low-level byte slice multiplexing.
  • High performance, See: [Benchmarks].