ffjson

package
v0.0.0-...-ab793d0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2015 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(v interface{}) ([]byte, error)

Marshal will act the same way as json.Marshal, except it will choose the ffjson marshal function before falling back to using json.Marshal. Using this function will bypass the internal copying and parsing the json library normally does, which greatly speeds up encoding time. It is ok to call this function even if no ffjson code has been generated for the data type you pass in the interface.

func MarshalFast

func MarshalFast(v interface{}) ([]byte, error)

MarshalFast will unmarshal the data if fast marshall is available. This function can be used if you want to be sure the fast marshal is used or in testing. If you would like to have fallback to encoding/json you can use the Marshal() method.

func Pool

func Pool(b []byte)

Send a buffer to the Pool to reuse for other instances.

On servers where you have a lot of concurrent encoding going on, you can hand back the byte buffer you get marshalling once you are done using it.

You may no longer utilize the content of the buffer, since it may be used by other goroutines.

func Unmarshal

func Unmarshal(data []byte, v interface{}) error

Unmarshal will act the same way as json.Unmarshal, except it will choose the ffjson unmarshal function before falling back to using json.Unmarshal. The overhead of unmarshal is lower than on Marshal, however this should still provide a speedup for your encoding. It is ok to call this function even if no ffjson code has been generated for the data type you pass in the interface.

func UnmarshalFast

func UnmarshalFast(data []byte, v interface{}) error

UnmarshalFast will unmarshal the data if fast marshall is available. This function can be used if you want to be sure the fast unmarshal is used or in testing. If you would like to have fallback to encoding/json you can use the Unmarshal() method.

Types

This section is empty.

Jump to

Keyboard shortcuts

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