Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for encodeState (0.43 sec)

  1. src/encoding/json/encode.go

    var encodeStatePool sync.Pool
    
    func newEncodeState() *encodeState {
    	if v := encodeStatePool.Get(); v != nil {
    		e := v.(*encodeState)
    		e.Reset()
    		if len(e.ptrSeen) > 0 {
    			panic("ptrEncoder.encode should have emptied ptrSeen via defers")
    		}
    		e.ptrLevel = 0
    		return e
    	}
    	return &encodeState{ptrSeen: make(map[any]struct{})}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:18:55 UTC 2024
    - 36.2K bytes
    - Viewed (0)
  2. src/encoding/json/bench_test.go

    				b.Fatal("Marshal error: got nil, want non-nil")
    			}
    		}
    	}
    }
    
    func BenchmarkMarshalBytes(b *testing.B) {
    	b.ReportAllocs()
    	// 32 fits within encodeState.scratch.
    	b.Run("32", benchMarshalBytes(32))
    	// 256 doesn't fit in encodeState.scratch, but is small enough to
    	// allocate and avoid the slower base64.NewEncoder.
    	b.Run("256", benchMarshalBytes(256))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 15:00:17 UTC 2024
    - 12.5K bytes
    - Viewed (0)
  3. src/encoding/gob/encode.go

    	"sync"
    )
    
    const uint64Size = 8
    
    type encHelper func(state *encoderState, v reflect.Value) bool
    
    // encoderState is the global execution state of an instance of the encoder.
    // Field numbers are delta encoded and always increase. The field
    // number is initialized to -1 so 0 comes out as delta(1). A delta of
    // 0 terminates the structure.
    type encoderState struct {
    	enc      *Encoder
    	b        *encBuffer
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 02:00:26 UTC 2024
    - 19K bytes
    - Viewed (0)
  4. src/encoding/gob/encgen.go

    import (
    	"reflect"
    )
    
    `
    
    const arrayHelper = `
    func enc%[2]sArray(state *encoderState, v reflect.Value) bool {
    	// Can only slice if it is addressable.
    	if !v.CanAddr() {
    		return false
    	}
    	return enc%[2]sSlice(state, v.Slice(0, v.Len()))
    }
    `
    
    const sliceHelper = `
    func enc%[2]sSlice(state *encoderState, v reflect.Value) bool {
    	slice, ok := v.Interface().([]%[1]s)
    	if !ok {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 22 16:39:09 UTC 2024
    - 3.8K bytes
    - Viewed (0)
Back to top