Commit 9eee325
Microoptimize getSerializedSize() for repeated message fields by hoisting the encoded tag size constant to the gencode instead of recomputing it per value in the repeated.
While this should be a small optimization win post-JIT, this shape of behavior was previously added for every other non-packed repeated fields; the divergence of only repeated message fields not hoisting the tag size to protoc time seems likely to only be an oversight.
Map fields are the other case which does not do this, but that is left for later work since that case may be able to be more 'deeply' better special cased since both the outer per-Entry tag size and the inner key/value tag sizes are known, but it is harder to trivialy do the 'inner' tag sizes safely since map entries are handled with or without implicit presence on the keys/values depending, which means the key tag and value tag may or may not be included at all based on both the map entry descriptor and the key/value contents.
PiperOrigin-RevId: 8504893341 parent 33b16e8 commit 9eee325
1 file changed
+18
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
82 | 86 | | |
83 | 87 | | |
84 | 88 | | |
| |||
783 | 787 | | |
784 | 788 | | |
785 | 789 | | |
786 | | - | |
787 | | - | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
788 | 793 | | |
789 | 794 | | |
790 | 795 | | |
| |||
1275 | 1280 | | |
1276 | 1281 | | |
1277 | 1282 | | |
1278 | | - | |
1279 | | - | |
1280 | | - | |
1281 | | - | |
1282 | | - | |
1283 | | - | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
1284 | 1294 | | |
1285 | 1295 | | |
1286 | 1296 | | |
| |||
0 commit comments