fast-path.not.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  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. func fastpathDecodeSetZeroTypeSwitch(iv interface{}, d *Decoder) bool { return false }
  17. type fastpathT struct{}
  18. type fastpathE struct {
  19. rtid uintptr
  20. rt reflect.Type
  21. encfn func(*Encoder, *codecFnInfo, reflect.Value)
  22. decfn func(*Decoder, *codecFnInfo, reflect.Value)
  23. }
  24. type fastpathA [0]fastpathE
  25. func (x fastpathA) index(rtid uintptr) int { return -1 }
  26. var fastpathAV fastpathA
  27. var fastpathTV fastpathT