Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultDecoderBufferSize is the initial buffer size of StreamDecoder DefaultDecoderBufferSize uint = 128 * 1024 // DefaultEncoderBufferSize is the initial buffer size of Encoder DefaultEncoderBufferSize uint = 128 * 1024 )
View Source
var ( // Default value(3) means the compiler only inline 3 layers of nested struct. // when the depth exceeds, the compiler will recurse // and compile subsequent structs when they are decoded DefaultMaxInlineDepth = 3 // Default value(1) means `Pretouch()` will be recursively executed once, // if any nested struct is left (depth exceeds MaxInlineDepth) DefaultRecursiveDepth = 1 )
Functions ¶
This section is empty.
Types ¶
type CompileOption ¶
type CompileOption func(o *CompileOptions)
CompileOption is a function used to change DefaultCompileOptions.
func WithCompileMaxInlineDepth ¶ added in v1.4.0
func WithCompileMaxInlineDepth(depth int) CompileOption
WithCompileMaxInlineDepth sets the max depth of inline compile in decoder and encoder.
For large nested struct, try to set smaller depth to reduce compiling time.
func WithCompileRecursiveDepth ¶
func WithCompileRecursiveDepth(loop int) CompileOption
WithCompileRecursiveDepth sets the loop times of recursive pretouch in both decoder and encoder, for both concrete type and its pointer type.
For deep nested struct (depth exceeds MaxInlineDepth), try to set more loops to completely compile, thus reduce JIT unstability in the first hit.
type CompileOptions ¶
type CompileOptions struct { // the maximum depth for compilation inline MaxInlineDepth int // the loop times for recursively pretouch RecursiveDepth int }
CompileOptions includes all options for encoder or decoder compiler.
func DefaultCompileOptions ¶
func DefaultCompileOptions() CompileOptions
DefaultCompileOptions set default compile options.
Click to show internal directories.
Click to hide internal directories.