test

package module
v0.0.0-...-bb67a98 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

README

go-benchmarks

Benchmarks used in So You Wanna Go Fast?.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Iface

type Iface interface {
	Foo()
}

type RingBufferPadded

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

RingBufferPadded is a MPMC buffer that achieves threadsafety with CAS operations only. A put on full or get on empty call will block until an item is put or retrieved. Calling Dispose on the RingBufferPadded will unblock any blocked threads with an error. This buffer is similar to the buffer described here: http://www.1024cores.net/home/lock-free-algorithms/queues/bounded-mpmc-queue with some minor additions.

func NewRingBufferPadded

func NewRingBufferPadded(size uint64) *RingBufferPadded

NewRingBufferPadded will allocate, initialize, and return a ring buffer with the specified size.

func (*RingBufferPadded) Cap

func (rb *RingBufferPadded) Cap() uint64

Cap returns the capacity of this ring buffer.

func (*RingBufferPadded) Dispose

func (rb *RingBufferPadded) Dispose()

Dispose will dispose of this queue and free any blocked threads in the Put and/or Get methods. Calling those methods on a disposed queue will return an error.

func (*RingBufferPadded) Get

func (rb *RingBufferPadded) Get() (interface{}, error)

Get will return the next item in the queue. This call will block if the queue is empty. This call will unblock when an item is added to the queue or Dispose is called on the queue. An error will be returned if the queue is disposed.

func (*RingBufferPadded) IsDisposed

func (rb *RingBufferPadded) IsDisposed() bool

IsDisposed will return a bool indicating if this queue has been disposed.

func (*RingBufferPadded) Len

func (rb *RingBufferPadded) Len() uint64

Len returns the number of items in the queue.

func (*RingBufferPadded) Offer

func (rb *RingBufferPadded) Offer(item interface{}) (bool, error)

Offer adds the provided item to the queue if there is space. If the queue is full, this call will return false. An error will be returned if the queue is disposed.

func (*RingBufferPadded) Put

func (rb *RingBufferPadded) Put(item interface{}) error

Put adds the provided item to the queue. If the queue is full, this call will block until an item is added to the queue or Dispose is called on the queue. An error will be returned if the queue is disposed.

type Struct

type Struct struct {
	Field1 string
	Field2 int
	Field3 []string
	Field4 uint64
	Field5 string
	Field6 string
	Field7 []byte
}

func (*Struct) DecodeMsg

func (z *Struct) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Struct) EncodeMsg

func (z *Struct) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Struct) Foo

func (s *Struct) Foo()

func (*Struct) MarshalJSON

func (mj *Struct) MarshalJSON() ([]byte, error)

func (*Struct) MarshalJSONBuf

func (mj *Struct) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*Struct) MarshalMsg

func (z *Struct) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Struct) Msgsize

func (z *Struct) Msgsize() (s int)

func (*Struct) UnmarshalJSON

func (uj *Struct) UnmarshalJSON(input []byte) error

func (*Struct) UnmarshalJSONFFLexer

func (uj *Struct) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

func (*Struct) UnmarshalMsg

func (z *Struct) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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