diff options
author | Joshua Haberman <joshua@reverberate.org> | 2011-04-04 00:09:14 -0700 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2011-04-04 00:09:14 -0700 |
commit | 066d1e024c27d8171667ed28ff209ec24e031aba (patch) | |
tree | a51a00ac902b8c2ae40af5a4bb4e16067d3ec729 /src/upb.h | |
parent | d6cebc329bf849f527f8a46d75799222f05d852d (diff) |
Speed up parsetostruct by using type-specialized callbacks.
Diffstat (limited to 'src/upb.h')
-rw-r--r-- | src/upb.h | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -54,9 +54,16 @@ INLINE size_t upb_align_up(size_t val, size_t align) { // The maximum number of fields that any one .proto type can have. Note that // this is very different than the max field number. It is hard to imagine a -// scenario where more than 32k fields (each with its own name and field number) -// makes sense. -#define UPB_MAX_FIELDS (1<<15) +// scenario where more than 2k fields (each with its own name and field number) +// makes sense. The .proto file to describe it would be 2000 lines long and +// contain 2000 unique names. +// +// With this limit we can store a has-bit offset in 8 bits (2**8 * 8 = 2048) +// and we can store a value offset in 16 bits, since the maximum message +// size is 16,640 bytes (2**8 has-bits + 2048 * 8-byte value). Note that +// strings and arrays are not counted in this, only the *pointer* to them is. +// An individual string or array is unaffected by this 16k byte limit. +#define UPB_MAX_FIELDS (2048) typedef int16_t upb_field_count_t; // Nested type names are separated by periods. |