commit | aa279b58ae6112e3b1a6f6fbf4d47bc3237c5e25 | [log] [tgz] |
---|---|---|
author | Todd Wang <toddw@google.com> | Tue Apr 12 13:35:41 2016 -0700 |
committer | Todd Wang <toddw@google.com> | Tue Apr 12 13:35:41 2016 -0700 |
tree | 3b75d98afb9e41e660c634f51b71ce818850f084 | |
parent | dd0bff607432f9ae9a0f9d3a843552adeb055a05 [diff] |
vdl: Implement vdl.Read, the reflect-based version of VDLRead. As with vom.xDecoder, there aren't tests yet for this logic. However the logic is much simpler than the original convert.go logic, and it's possible to read the code and reason about why certain branches are taken, and how cases are handled. I'll add comprehensive tests using a new vdltest package in a future CL. I have tested manually, and have hacked the benchmarks to run using the new vom.XDecoder, but without any code-generated VDLRead methods. The numbers are just for reference; right now the goal is to get everything implemented correctly, and we can optimize later. Here's the results of those benchmarks. In all cases the reflect-based vdl.Read is "new", while we compare against various different "old" states. * Compare against "old" code-generated Target interface. * It's surprising that the numbers are comparable, since the * "new" code uses reflection, not code-generation. * * I don't know why the 1000Customer case is so much slower. [old=Target new=reflect] old ns/op new ns/op delta VomDecodeRequest 10782 9186 -14.80% VomDecodeResponse 2038 2047 +0.44% VomDecodeCustomer 5927 5960 +0.56% VomDecoder1Customer 197267 204620 +3.73% VomDecoder1000Customer 4815771 8141702 +69.06% * Compare against "old" code-generated VDLRead methods. We * expect the new code to be slower, since it uses reflection. * * I don't know why the DecodeCustomer and Decoder1Customer cases * are so close. [old=codegen new=reflect] old ns/op new ns/op delta VomDecodeRequest 2711 9186 +238.84% VomDecodeResponse 948 2047 +115.93% VomDecodeCustomer 5967 5960 -0.12% VomDecoder1Customer 197229 204620 +3.75% VomDecoder1000Customer 3031866 8141702 +168.54% * Compare against "old" protobuf code-generated methods. We * expect the new code to be slower, since it uses reflection. [old=proto new=reflect] old ns/op new ns/op delta DecodeRequest 1890 9186 +386.03% DecodeResponse 1081 2047 +89.36% * Compare against "old" reflection-based gob. We want the new * code to be comparable, but it's currently much slower. [old=gob new=reflect] old ns/op new ns/op delta Decoder1Customer 58117 204620 +252.08% Decoder1000Customer 2734031 8141702 +197.79% Change-Id: Ic0291f0af51327937e68ff927d6bafe9b27e8ffe
This repository defines the Go APIs of Vanadium.