fast-path.not.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. // +build notfastpath
  2. package codec
  3. import "reflect"
  4. const fastpathEnabled = false
  5. // The generated fast-path code is very large, and adds a few seconds to the build time.
  6. // This causes test execution, execution of small tools which use codec, etc
  7. // to take a long time.
  8. //
  9. // To mitigate, we now support the notfastpath tag.
  10. // This tag disables fastpath during build, allowing for faster build, test execution,
  11. // short-program runs, etc.
  12. func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { return false }
  13. func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { return false }
  14. func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { return false }
  15. func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { return false }
  16. type fastpathT struct{}
  17. type fastpathE struct {
  18. rtid uintptr
  19. rt reflect.Type
  20. encfn func(*encFnInfo, reflect.Value)
  21. decfn func(*decFnInfo, reflect.Value)
  22. }
  23. type fastpathA [0]fastpathE
  24. func (x fastpathA) index(rtid uintptr) int { return -1 }
  25. var fastpathAV fastpathA
  26. var fastpathTV fastpathT