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 []byte, s string) []byte
- func AppendSafe(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() int64
- func MonotonicDuration() 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() 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
var Spaces = []byte(" ")
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 AppendSafe ¶
AppendSafe appends string to buffer with JSON compatible esaping. It does NOT add quotes.
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], ...)