labs23

package
v0.0.0-...-6c2044b Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

README

测试interface{}类型转换判断和布尔值判断效率差异。

测试结果:

dada-imac:labs23 dada$ go test -v -bench=".*"
testing: warning: no tests to run
PASS
Benchmark_UseInterface1	100000000	        10.4 ns/op
Benchmark_UseInterface2	100000000	        10.1 ns/op
Benchmark_UseBoolean	100000000	        13.2 ns/op
ok  	github.com/idada/go-labs/labs23	3.410s

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferConn

type BufferConn struct {
}

func (*BufferConn) Writer

func (c *BufferConn) Writer(i int) int

type Conn

type Conn interface {
	Writer(i int) int
}

type MyObject

type MyObject struct {
	UseBufferConn bool
	Conn          Conn
}

func (*MyObject) UseBoolean

func (obj *MyObject) UseBoolean(i int) int

func (*MyObject) UseInterface

func (obj *MyObject) UseInterface(i int) int

type NormalConn

type NormalConn struct {
}

func (*NormalConn) Writer

func (c *NormalConn) Writer(i int) int

Jump to

Keyboard shortcuts

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