Documentation ¶
Index ¶
- Variables
- func AppendPrint(b []byte, a ...interface{}) []byte
- func AppendPrintf(b []byte, format string, a ...interface{}) []byte
- func AppendPrintln(b []byte, a ...interface{}) []byte
- func AppendQuote(b, s []byte) []byte
- func AppendQuoteString(b []byte, s string) []byte
- func AppendSafe(b, s []byte) []byte
- func AppendSafeString(b []byte, s string) []byte
- func BytesHash(s []byte, h uintptr) uintptr
- func Fastrand() uint32
- func Getbuf() (_ Buf, wr *Bwr)
- func InterfaceData(v interface{}) unsafe.Pointer
- func IsNil(v interface{}) bool
- func MemHash(p unsafe.Pointer, h, s uintptr) uintptr
- func MemHash32(p unsafe.Pointer, h uintptr) uintptr
- func MemHash64(p unsafe.Pointer, h uintptr) uintptr
- func Monotonic() (t int64)
- func MonotonicDuration() (t time.Duration)
- func Since(monotonic int64) time.Duration
- func SplitTime(t time.Time) (year, month, day, hour, min, sec int)
- func StrHash(s string, h uintptr) uintptr
- func UnixNano() (t int64)
- func UnsafeBytesToString(b []byte) string
- func UnsafeString(ptr unsafe.Pointer, l int) string
- type Buf
- type Bwr
Constants ¶
This section is empty.
Variables ¶
var RunID string
RunID is a random string generated at start.
var Spaces = []byte(" ")
Spaces is for padding strings.
Used as buf = append(buf, Spaces[:padWidth]...)
Functions ¶
func AppendPrint ¶ added in v0.11.0
AppendPrint is similar to fmt.Sprint but faster. See doc for AppendPrintf for more details.
func AppendPrintf ¶
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 ¶
AppendPrintln is similar to fmt.Sprintln but faster. See doc for AppendPrintf for more details.
func AppendQuote ¶
func AppendQuoteString ¶ added in v0.13.0
func AppendSafe ¶
AppendSafe appends string to buffer with JSON compatible esaping. It does NOT add quotes.
func AppendSafeString ¶ added in v0.13.0
func Getbuf ¶
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 Monotonic ¶
func Monotonic() (t int64)
Monotonic is runtime function. It returns monotonic nanoseconds.
func MonotonicDuration ¶
MonotonicDuration is runtime function. It returns monotonic time.