Joshua Haberman
5797d95172
Merge pull request #348 from haberman/json-emit-defaults
...
Fixes for JSON encoder when emitting default values.
4 years ago
Joshua Haberman
7a17493269
Removed print debugging.
4 years ago
Joshua Haberman
695b7f4617
Added code to test UPB_JSONENC_EMITDEFAULTS.
4 years ago
Joshua Haberman
6b357607bd
Fixed bugs in JSON encoding with UPB_JSONENC_EMITDEFAULTS.
...
Previously the code would crash on certain empty fields.
4 years ago
Joshua Haberman
1b08391979
Merge pull request #347 from haberman/filedef-symtab
...
Added an accessor to get the symtab from a filedef.
4 years ago
Joshua Haberman
ee49a8d7df
Added an accessor to get the symtab from a filedef.
...
This matches an API already present in proto2
(const DescriptorPool* FileDescriptor::pool()).
However there is a slightly subtle implication here.
In proto2, the relationship between Descriptor and
MessageFactory is 1:many. You can create as many
DynamicMessageFactory instances as you want, and
each one will have its own independent DynamicMessage
prototype and computed layout for the same underlying
Descriptor. In practice the layouts will all be the same,
but one thing that could be distinct is that each can
have its own extension pool, which is a DescriptorPool
that will be searched for extensions when parsing.
In contrast, upb does not have a separate "message
factory" abstraction. That means that each upb_msgdef
has a single distinct layout, in other words a 1:1
correspondence between descriptor and layout. This means
that there is no way to create multiple message types
for the same descriptor that have distinct extension
pools. If you want a different set of extensions, you
must create a separate upb_symtab with a distinct set
of descriptors.
This change further entrenches that upb_filedef:upb_symtab
is a 1:1 relationship. A single upb_filedef cannot be a
member of multiple symbol tables. In practice this was
already true (there is no way to add a single filedef to
multiple symbol tables) but this change codifies this
1:1 relationship.
4 years ago
Joshua Haberman
a81b47025a
Merge pull request #345 from haberman/encode-skipunknown
...
Added option to binary encoder to skip unknown fields.
4 years ago
Joshua Haberman
6535cbe380
Merge pull request #346 from timgates42/bugfix_typo_position
...
docs: fix simple typo, posisiton -> position
4 years ago
Tim Gates
7225108720
docs: fix simple typo, posisiton -> position
...
There is a small typo in upb/table.c.
Should read `position` rather than `posisiton`.
4 years ago
Joshua Haberman
871ff96252
Test SKIPUNKNOWN on regular fields.
4 years ago
Joshua Haberman
0569c22a1e
Removed debug print.
4 years ago
Joshua Haberman
76764643ac
Added option to binary encoder to skip unknown fields.
4 years ago
Joshua Haberman
794ce6d061
Merge pull request #344 from haberman/deterministic-serialize
...
Added map sorting to binary and text encoders.
4 years ago
Joshua Haberman
a04627abc8
Added map sorting to binary and text encoders.
...
For the binary encoder, sorting is off by default.
For the text encoder, sorting is on by default.
Both defaults can be explicitly overridden.
This grows code size a bit. I think we could potentially
shave this (and other map-related code size) by having
the generated code inject a function pointer to the map-related
parsing/serialization code if maps are present.
FILE SIZE VM SIZE
-------------- --------------
+86% +1.07Ki +71% +768 upb/msg.c
[NEW] +391 [NEW] +344 _upb_mapsorter_pushmap
[NEW] +158 [NEW] +112 _upb_mapsorter_cmpstr
[NEW] +111 [NEW] +64 _upb_mapsorter_cmpbool
[NEW] +110 [NEW] +64 _upb_mapsorter_cmpi32
[NEW] +110 [NEW] +64 _upb_mapsorter_cmpi64
[NEW] +110 [NEW] +64 _upb_mapsorter_cmpu32
[NEW] +110 [NEW] +64 _upb_mapsorter_cmpu64
-3.6% -8 -4.3% -8 _upb_map_new
+9.5% +464 +9.2% +424 upb/text_encode.c
[NEW] +656 [NEW] +616 txtenc_mapentry
+15% +32 +20% +32 upb_text_encode
-20.1% -224 -20.7% -224 txtenc_msg
+5.7% +342 +5.3% +296 upb/encode.c
[NEW] +344 [NEW] +304 encode_mapentry
[NEW] +246 [NEW] +208 upb_encode_ex
[NEW] +41 [NEW] +16 upb_encode_ex.ch
+0.7% +8 +0.7% +8 encode_scalar
-1.0% -32 -1.0% -32 encode_message
[DEL] -38 [DEL] -16 upb_encode.ch
[DEL] -227 [DEL] -192 upb_encode
+2.0% +152 +2.2% +152 upb/decode.c
+44% +128 +44% +128 [section .rodata]
+3.4% +24 +3.4% +24 _GLOBAL_OFFSET_TABLE_
+0.6% +107 +0.3% +48 upb/def.c
[NEW] +100 [NEW] +48 upb_fielddef_descriptortype
+7.1% +7 [ = ] 0 upb_fielddef_defaultint32
+2.9% +24 +2.9% +24 [section .dynsym]
+1.2% +24 [ = ] 0 [section .symtab]
+3.2% +16 +3.2% +16 [section .plt]
[NEW] +16 [NEW] +16 memcmp@plt
+0.5% +16 +0.6% +16 tests/conformance_upb.c
+1.5% +16 +1.6% +16 DoTestIo
+0.1% +16 +0.1% +16 upb/json_decode.c
+0.4% +16 +0.4% +16 jsondec_wellknown
+3.0% +8 +3.0% +8 [section .got.plt]
+3.0% +8 +3.0% +8 _GLOBAL_OFFSET_TABLE_
+1.6% +7 +1.6% +7 [section .dynstr]
+1.8% +4 +1.8% +4 [section .hash]
+0.5% +3 +0.5% +3 [LOAD #2 [RX]]
+2.8% +2 +2.8% +2 [section .gnu.version]
-60.0% -1.74Ki [ = ] 0 [Unmapped]
+0.3% +496 +1.4% +1.74Ki TOTAL
4 years ago
Joshua Haberman
3e071ea91a
Merge pull request #343 from haberman/msvc
...
MSVC apparently doesn't support the standard C/C++ defines.
4 years ago
Joshua Haberman
e70e488e09
MSVC apparently doesn't support the standard C/C++ defines.
...
Our requirement then is C99, C++11, or MSVC >= 2015.
4 years ago
Joshua Haberman
963e501aa6
Merge pull request #342 from haberman/fuzz
...
Clamp 32-bit varints to 5 bytes to fix a fuzz failure.
4 years ago
Joshua Haberman
8d670d8aea
Renamed decode_varint32() to decode_tag().
4 years ago
Joshua Haberman
9abf8e043f
Clamp 32-bit varints to 5 bytes to fix a fuzz failure.
4 years ago
Joshua Haberman
50a543de7f
Merge pull request #341 from haberman/code-size
...
Added size benchmark for CODE_SIZE.
4 years ago
Joshua Haberman
9c87f1168f
Added size benchmark for CODE_SIZE.
4 years ago
Joshua Haberman
6f82028236
Merge pull request #340 from haberman/darwin-setjmp
...
Use _setjmp() instead of setjmp() on Apple platforms
4 years ago
Joshua Haberman
358fa14d0e
Fixed headers and updated benchmark script.
4 years ago
Joshua Haberman
bc200451ce
Use a macro instead of an inline function for setjmp/longjmp.
4 years ago
Joshua Haberman
ca279f8afa
Merge branch 'master' into darwin-setjmp
4 years ago
Joshua Haberman
fbc0639b07
Use _setjmp on mac to avoid saving/restoring the signal mask.
4 years ago
Joshua Haberman
10f0a38450
Merge pull request #337 from haberman/size-benchmarks
...
Size benchmarks for upb and protobuf binaries
4 years ago
Joshua Haberman
4be07a2dce
Increase build timeout until we can parallelize the build.
4 years ago
Joshua Haberman
378a27b640
Force "size" to run locally.
4 years ago
Joshua Haberman
da48e01f05
More google3 fixes.
4 years ago
Joshua Haberman
d2446fd2db
Moved cc_api_version attribute to proto_library().
4 years ago
Joshua Haberman
4a84390c89
Added cc_proto_library() tweaks for google3.
4 years ago
Joshua Haberman
4dd4212a34
Merge branch 'master' into size-benchmarks
4 years ago
Joshua Haberman
ffecfef161
Merge branch 'master' into size-benchmarks
4 years ago
Joshua Haberman
86f671d5fd
Fix for Darwin (output is different, but it won't error out).
4 years ago
Joshua Haberman
165e01ec6f
Fix for old Python versions.
4 years ago
Joshua Haberman
40fdff5e43
Merge pull request #339 from haberman/benchmark-alias
...
Added (temporary?) API for copy vs. alias and added benchmarks to test both.
4 years ago
Joshua Haberman
5f8bb5de1d
Updated generated code.
4 years ago
Joshua Haberman
65d166a6ba
Added API for copy vs. alias and added benchmarks to test both.
...
Benchmark output:
$ bazel-bin/benchmarks/benchmark '--benchmark_filter=BM_Parse'
2020-11-11 15:39:04
Running bazel-bin/benchmarks/benchmark
Run on (72 X 3700 MHz CPU s)
CPU Caches:
L1 Data 32K (x36)
L1 Instruction 32K (x36)
L2 Unified 1024K (x36)
L3 Unified 25344K (x2)
-------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
-------------------------------------------------------------------------------------
BM_Parse_Upb_FileDesc<UseArena, Copy> 4134 ns 4134 ns 168714 1.69152GB/s
BM_Parse_Upb_FileDesc<UseArena, Alias> 3487 ns 3487 ns 199509 2.00526GB/s
BM_Parse_Upb_FileDesc<InitBlock, Copy> 3727 ns 3726 ns 187581 1.87643GB/s
BM_Parse_Upb_FileDesc<InitBlock, Alias> 3110 ns 3110 ns 224970 2.24866GB/s
BM_Parse_Proto2<FileDesc, NoArena, Copy> 31132 ns 31132 ns 22437 229.995MB/s
BM_Parse_Proto2<FileDesc, UseArena, Copy> 21011 ns 21009 ns 33922 340.812MB/s
BM_Parse_Proto2<FileDesc, InitBlock, Copy> 17976 ns 17975 ns 38808 398.337MB/s
BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 17357 ns 17356 ns 40244 412.539MB/s
4 years ago
Joshua Haberman
27b9c999a7
Merge pull request #338 from haberman/arena-initial
...
Start arena block doubling at initial block size.
4 years ago
Joshua Haberman
9df96874e9
Start arena block doubling at initial block size.
...
If an initial block is provided, we should start our
block doubling at the size of the initial block, not 128.
This saves us from unnecessary overhead when we overflow
the initial block.
4 years ago
Joshua Haberman
881ddac7fe
Also use .format() for gen_synthetic_protos.py.
4 years ago
Joshua Haberman
8b7dabe1a2
Use format() instead of string interpolation, for old Python versions.
4 years ago
Joshua Haberman
8e08282c3b
Removed unused small.proto.
4 years ago
Joshua Haberman
0f79d47215
Added missing lite binaries to size_data.txt.
4 years ago
Joshua Haberman
555fbbc0bc
Size benchmarks are working pretty well.
4 years ago
Joshua Haberman
85cbc41a89
Merge branch 'master' into size-benchmarks
4 years ago
Joshua Haberman
e5bdfba92c
Removed accidentally-added .orig file.
4 years ago
Joshua Haberman
07851fac58
Merge pull request #336 from haberman/fuzz
...
Fixed a few minor bugs found by fuzzing.
4 years ago
Joshua Haberman
982b634bc5
Fixed a few minor bugs found by fuzzing.
4 years ago