vdl: Add generated vars for TypeOf, for better performance.
Also changed vdl.Decoder.StartValue to take a *vdl.Type argument,
and perform the compatibility check. This gives up to an
additional 10% improvement, and makes it easier to optimize the
compatibility check in the future, since it's now only performed
by the 3 decoders (vom, vdl.Value and vdl.pipe).
Some numbers. In general all the generated stuff gets better:
old ns/op new ns/op delta
RpcRequestZeroSingleShotEncode 51010 41028 -19.57%
RpcRequestZeroRepeatedEncode 302 194 -35.76%
RpcRequestZeroSingleShotDecode 1962 1636 -16.62%
RpcRequestZeroRepeatedDecode 484 281 -41.94%
RpcRequestFullSingleShotEncode 63755 47481 -25.53%
RpcRequestFullRepeatedEncode 9407 5558 -40.92%
RpcRequestFullSingleShotDecode 58886 58863 -0.04%
RpcRequestFullRepeatedDecode 55303 54106 -2.16%
RpcResponseZeroSingleShotEncode 51700 40604 -21.46%
RpcResponseZeroRepeatedEncode 635 514 -19.06%
RpcResponseZeroSingleShotDecode 2026 1755 -13.38%
RpcResponseZeroRepeatedDecode 524 304 -41.98%
RpcResponseFullSingleShotEncode 106038 91816 -13.41%
RpcResponseFullRepeatedEncode 44273 42005 -5.12%
RpcResponseFullSingleShotDecode 43271 42635 -1.47%
RpcResponseFullRepeatedDecode 38608 37251 -3.51%
For some reason, the reflect version of large-list single-shot
encoding gets much worse. I'm not sure why. But I'm going to
ignore that for now, since I think there's plenty of other
optimizations we can explore.
old ns/op new ns/op delta
LargeListSingleShotEncodeReflect 19279360 21696617 +12.54%
LargeListRepeatedEncodeReflect 19055693 19550742 +2.60%
LargeListSingleShotDecodeReflect 34161615 32556162 -4.70%
LargeListRepeatedDecodeReflect 33647837 31846309 -5.35%
LargeListSingleShotEncode 3951128 3984021 +0.83%
LargeListRepeatedEncode 3870694 3895734 +0.65%
LargeListSingleShotDecode 5221050 5465362 +4.68%
LargeListRepeatedDecode 5211915 5246888 +0.67%
MultiPart: 5/5
Change-Id: I1dc50e95f037832daf1203456a07ab916b1e0d80
1 file changed