labs07

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

README

测试几种链表遍历查找的性能差异。

实验结果:

dada-imac:labs dada$ go test -test.bench="." labs07
PASS
Benchmark_Loop1    500000          4386 ns/op
Benchmark_Loop2    500000          5206 ns/op
Benchmark_Loop3    100000         14821 ns/op
Benchmark_Loop4     10000        135384 ns/op
Benchmark_Loop5      5000        607735 ns/op
Benchmark_Loop6    500000          7067 ns/op
ok      labs07  14.618s    

确认算法有效:

dada-imac:labs dada$ go test labs07 -v
=== RUN Test_Loop4
--- PASS: Test_Loop4 (0.00 seconds)
=== RUN Test_Loop5
--- PASS: Test_Loop5 (0.00 seconds)
=== RUN Test_Loop6
--- PASS: Test_Loop6 (0.00 seconds)
PASS
ok      labs07  0.016s

结论:有空做个查询表达式解析器吧。

Documentation

Index

Constants

View Source
const OP_EQ = 0 // ==

operator

View Source
const TP_INT = 0 // int

type

Variables

This section is empty.

Functions

This section is empty.

Types

type BigStruct

type BigStruct struct {
	C01 int
	C02 int
	C03 int
	C04 int
	C05 int
	C06 int
	C07 int
	C08 int
	C09 int
	C10 int
	C11 int
	C12 int
	C13 int
	C14 int
	C15 int
	C16 int
	C17 int
	C18 int
	C19 int
	C20 int
	C21 int
	C22 int
	C23 int
	C24 int
	C25 int
	C26 int
	C27 int
	C28 int
	C29 int
	C30 int
	// contains filtered or unexported fields
}

type Condition

type Condition struct {
	// contains filtered or unexported fields
}

func (*Condition) Match

func (c *Condition) Match(n uintptr) bool

type Query

type Query struct {
	// contains filtered or unexported fields
}

func NewQuery

func NewQuery(name string, operator string, value int) *Query

func (*Query) Match

func (q *Query) Match(n *BigStruct) bool

Jump to

Keyboard shortcuts

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