readbyte

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: 5 Imported by: 0

README

Reading each byte of a buffer

Each byte (bg) can be read using:

  • _, _ = bb.Read(bg)
  • bg, _ = bb.ReadByte()

When treating every byte, ReadByte provides 20%+ improvement. One less variable is part of the explanation.

src>go test -bench=. ./readbyte

Results

go version go1.12.6 windows/amd64

pkg: github.com/iWdGo/GoCompilerEfficiency/src/readbyte
BenchmarkBufferRead-4             200000              8540 ns/op
BenchmarkRBufferReadByte-4        200000              5971 ns/op
PASS

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadAllBytesRead

func ReadAllBytesRead(b *bytes.Buffer) (l int)

func ReadAllBytesReadByte

func ReadAllBytesReadByte(b *bytes.Buffer) (l int)

Types

This section is empty.

Jump to

Keyboard shortcuts

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