fast-path.not.go 1.0 KB

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