low

package
Version: v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RunID string
View Source
var Spaces = []byte("                                                                                                                                                ")

Functions

func AppendPrint added in v0.11.0

func AppendPrint(b []byte, a ...interface{}) []byte

AppendPrint is similar to fmt.Sprint but faster. See doc for AppendPrintf for more details.

func AppendPrintf

func AppendPrintf(b []byte, format string, a ...interface{}) []byte

AppendPrintf is similar to fmt.Fprintf but a little bit hacked.

There is no sync.Pool.Get and Put. There is no copying buffer to io.Writer or conversion to string. There is no io.Writer interface dereference. All that gives advantage about 30-50 ns per call. Yes, I know :).

func AppendPrintln

func AppendPrintln(b []byte, a ...interface{}) []byte

AppendPrintln is similar to fmt.Sprintln but faster. See doc for AppendPrintf for more details.

func AppendQuote

func AppendQuote(b []byte, s string) []byte

func AppendSafe

func AppendSafe(b []byte, s string) []byte

AppendSafe appends string to buffer with JSON compatible esaping. It does NOT add quotes.

func BytesHash

func BytesHash(s []byte, h uintptr) uintptr

func Fastrand

func Fastrand() uint32

func Getbuf

func Getbuf() (_ Buf, wr *Bwr)

Getbuf gets bytes buffer from a pool to reduce gc pressure. buffer is at least 100 bytes long. Buffer must be returned after used. Usage:

b, wr := tlog.Getbuf()
defer wr.Ret(&b)

b = append(b[:0], ...)

func InterfaceData added in v0.11.0

func InterfaceData(v interface{}) unsafe.Pointer

func IsNil added in v0.11.0

func IsNil(v interface{}) bool

func MemHash

func MemHash(p unsafe.Pointer, h, s uintptr) uintptr

func MemHash32

func MemHash32(p unsafe.Pointer, h uintptr) uintptr

func MemHash64

func MemHash64(p unsafe.Pointer, h uintptr) uintptr

func Monotonic

func Monotonic() int64

func MonotonicDuration

func MonotonicDuration() time.Duration

func Since

func Since(monotonic int64) time.Duration

func SplitTime

func SplitTime(t time.Time) (year, month, day, hour, min, sec int)

func StrHash

func StrHash(s string, h uintptr) uintptr

func UnixNano

func UnixNano() int64

func UnsafeBytesToString

func UnsafeBytesToString(b []byte) string

func UnsafeString added in v0.11.0

func UnsafeString(ptr unsafe.Pointer, l int) string

Types

type Buf

type Buf []byte

func (*Buf) NewLine

func (w *Buf) NewLine()

func (*Buf) Reset added in v0.11.0

func (w *Buf) Reset()

func (*Buf) Write

func (w *Buf) Write(p []byte) (int, error)

type Bwr

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

func (*Bwr) Ret

func (wr *Bwr) Ret(b *Buf)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL