fast-path.not.go (1390B)
1 // Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. 2 // Use of this source code is governed by a MIT license found in the LICENSE file. 3 4 //go:build notfastpath || codec.notfastpath 5 // +build notfastpath codec.notfastpath 6 7 package codec 8 9 import "reflect" 10 11 const fastpathEnabled = false 12 13 // The generated fast-path code is very large, and adds a few seconds to the build time. 14 // This causes test execution, execution of small tools which use codec, etc 15 // to take a long time. 16 // 17 // To mitigate, we now support the notfastpath tag. 18 // This tag disables fastpath during build, allowing for faster build, test execution, 19 // short-program runs, etc. 20 21 func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { return false } 22 func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { return false } 23 24 // func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { return false } 25 // func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { return false } 26 27 func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { return false } 28 29 type fastpathT struct{} 30 type fastpathE struct { 31 rtid uintptr 32 rt reflect.Type 33 encfn func(*Encoder, *codecFnInfo, reflect.Value) 34 decfn func(*Decoder, *codecFnInfo, reflect.Value) 35 } 36 type fastpathA [0]fastpathE 37 38 func fastpathAvIndex(rtid uintptr) int { return -1 } 39 40 var fastpathAv fastpathA 41 var fastpathTV fastpathT