emptycase

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

README

Switch useless check

Checking switch performance:

  • useless check with nop
  • skipping check and relying on default
  • returning default in the check

Whatever the choice, the switch has no noticeable variation of performance.

src>go test -bench=. ./switch

Results

go version go1.12 windows/amd64

BenchmarkCheckUselessCase-4     2000000000               0.43 ns/op
BenchmarkReturnDefault-4        2000000000               0.53 ns/op
BenchmarkNoUselessCase-4        2000000000               0.43 ns/op
PASS

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckNoUselessCase

func CheckNoUselessCase(a int) int

func CheckReturnDefault

func CheckReturnDefault(a int) int

func CheckUselessCase

func CheckUselessCase(a int) int

Types

This section is empty.

Jump to

Keyboard shortcuts

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