Speedup and cleanup vom encoder, some bugfixes.

This brings the vom Encoder implementation into a reasonable
state, performance-wise.  The technique is the same as on the
decoder side:
https://vanadium-review.googlesource.com/#/q/topic:toddw-fastdec

Also fixed a bug in the handling of bytes in vdl.newPipe.  Added
a bunch of comments in v.io/v23/vdl/pipe.go to describe the
general mechanism.

The important files to look at are under:
  v.io/v23/vdl
  v.io/v23/vom
  v.io/v23/verror
  v.io/x/ref/lib/vdl/codegen/golang

Here are the encoding benchmarks.  Note that there is higher
variance for these numbers than the decoder numbers, since
encoding requires allocations on the output buffer.  Our solution
to that will be chunked encoding, which isn't implemented here.

benchmark                          old ns/op  new ns/op    delta
Vom___Encode_____XNumber                6647       4216  -36.57%
Vom___EncodeMany_XNumber                 472        428   -9.32%
Vom___Encode_____VNumber                6482       5542  -14.50%
Vom___EncodeMany_VNumber                 176        174   -1.14%
Vom___Encode_____XStringSmall           6862       6531   -4.82%
Vom___EncodeMany_XStringSmall            527        460  -12.71%
Vom___Encode_____VStringSmall           6257       5685   -9.14%
Vom___EncodeMany_VStringSmall            196        188   -4.08%
Vom___Encode_____XStringLarge         133510     120660   -9.62%
Vom___EncodeMany_XStringLarge          55130      52237   -5.25%
Vom___Encode_____VStringLarge         130751     129680   -0.82%
Vom___EncodeMany_VStringLarge          53851      51242   -4.84%
Vom___Encode_____VEnum                  7093       6172  -12.98%
Vom___EncodeMany_VEnum                   191        183   -4.19%
Vom___Encode_____XByteListSmall         7351       6873   -6.50%
Vom___EncodeMany_XByteListSmall          579        472  -18.48%
Vom___Encode_____VByteListSmall         6623       6157   -7.04%
Vom___EncodeMany_VByteListSmall          187        177   -5.35%
Vom___Encode_____XByteListLarge       104355     104017   -0.32%
Vom___EncodeMany_XByteListLarge         8676       8696   +0.23%
Vom___Encode_____VByteListLarge        97597     100401   +2.87%
Vom___EncodeMany_VByteListLarge         8052       8231   +2.22%
Vom___Encode_____XByteArray             7364       7530   +2.25%
Vom___EncodeMany_XByteArray              745        749   +0.54%
Vom___Encode_____VByteArray             6595       6139   -6.91%
Vom___EncodeMany_VByteArray              215        202   -6.05%
Vom___Encode_____XArray                 8624       7307  -15.27%
Vom___EncodeMany_XArray                 1266        630  -50.24%
Vom___Encode_____VArray                 7358       6523  -11.35%
Vom___EncodeMany_VArray                  370        274  -25.95%
Vom___Encode_____XListSmall             8184       6991  -14.58%
Vom___EncodeMany_XListSmall             1505        688  -54.29%
Vom___Encode_____VListSmall             7000       6308   -9.89%
Vom___EncodeMany_VListSmall              390        288  -26.15%
Vom___Encode_____XListLarge         21629416    4103590  -81.03%
Vom___EncodeMany_XListLarge         20971508    3440893  -83.59%
Vom___Encode_____VListLarge          4816700    2821262  -41.43%
Vom___EncodeMany_VListLarge          4226822    2257347  -46.59%
Vom___Encode_____XListAnySmall         20538      20456   -0.40%
Vom___EncodeMany_XListAnySmall         11473      10555   -8.00%
Vom___Encode_____VListAnySmall         17542      13722  -21.78%
Vom___EncodeMany_VListAnySmall          9502       5963  -37.24%
Vom___Encode_____XListAnyLarge     242633472  186445853  -23.16%
Vom___EncodeMany_XListAnyLarge     231676344  184135888  -20.52%
Vom___Encode_____VListAnyLarge     243393646  232625450   -4.42%
Vom___EncodeMany_VListAnyLarge     204297618  208020229   +1.82%
Vom___Encode_____VSet                   7379       6520  -11.64%
Vom___EncodeMany_VSet                    539        435  -19.29%
Vom___Encode_____XMap                  10599       9060  -14.52%
Vom___EncodeMany_XMap                   3338       2743  -17.83%
Vom___Encode_____VMap                   6516       7004   +7.49%
Vom___EncodeMany_VMap                    719        527  -26.70%
Vom___Encode_____XSmallStruct          11613      10277  -11.50%
Vom___EncodeMany_XSmallStruct           2094       1630  -22.16%
Vom___Encode_____VSmallStruct           9404       8227  -12.52%
Vom___EncodeMany_VSmallStruct            470        405  -13.83%
Vom___Encode_____XLargeStruct          63816      51583  -19.17%
Vom___EncodeMany_XLargeStruct          37361      28332  -24.17%
Vom___Encode_____VLargeStruct          37287      32095  -13.92%
Vom___EncodeMany_VLargeStruct          11101       9271  -16.49%
Vom___Encode_____XLargeStructZero      43606      40770   -6.50%
Vom___EncodeMany_XLargeStructZero      19131      17869   -6.60%
Vom___Encode_____VLargeStructZero      23724      23690   -0.14%
Vom___EncodeMany_VLargeStructZero        224        217   -3.12%
Vom___Encode_____VSmallUnion            9225       7531  -18.36%
Vom___EncodeMany_VSmallUnion             266        227  -14.66%
Vom___Encode_____Time                   9340      10026   +7.34%
Vom___EncodeMany_Time                   1794       1732   -3.46%
Vom___Encode_____Blessings             41833      38908   -6.99%
Vom___EncodeMany_Blessings              5743       5291   -7.87%
Vom___Encode_____RPCRequestZero        50452      47035   -6.77%
Vom___EncodeMany_RPCRequestZero          217        208   -4.15%
Vom___Encode_____RPCRequestFull        63186      56772  -10.15%
Vom___EncodeMany_RPCRequestFull         5448       4803  -11.84%
Vom___Encode_____RPCResponseZero       51641      45973  -10.98%
Vom___EncodeMany_RPCResponseZero         809        831   +2.72%
Vom___Encode_____RPCResponseFull      101767     105144   +3.32%
Vom___EncodeMany_RPCResponseFull       57135      55317   -3.18%

MultiPart: 5/5
Change-Id: Iebe9a94708d4b5faadf5673418dd33758ae534df
1 file changed
tree: 6dab1390326ac2640ac50551a1415ec006b0f616
  1. go/
  2. .gitignore
  3. AUTHORS
  4. CONTRIBUTING.md
  5. CONTRIBUTORS
  6. LICENSE
  7. PATENTS
  8. VERSION