returnbuffer

package
v0.0.0-...-b91b1e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2019 License: BSD-2-Clause Imports: 3 Imported by: 0

README

Returning bytes.Buffer content

Content can be returned as:

  • a buffer
  • as an array of bytes
  • as a string

Returning a string from the buffer is marginally more expensive as expected.

src>go test -bench=. ./returnbuffer

Results

go version go1.12.6 windows/amd64

pkg: github.com/iWdGo/GoCompilerEfficiency/src/returnbuffer
BenchmarkReturnBuffer-4                   300000              4367 ns/op
BenchmarkReturnBufferString-4             300000              4570 ns/op
BenchmarkReturnBufferBytes-4              300000              4360 ns/op
PASS

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReturnBuffer

func ReturnBuffer(f int) *bytes.Buffer

func ReturnBufferBytes

func ReturnBufferBytes(f int) []byte

func ReturnBufferString

func ReturnBufferString(f int) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL