Joshua Haberman
496f638025
Merge pull request #330 from haberman/symtab-longjmp
...
symtab: use longjmp() for errors and avoid intermediate table.
4 years ago
Joshua Haberman
c9f9668234
symtab: use longjmp() for errors and avoid intermediate table.
...
We used to use a separate "add table" during the upb_symtab_addfile()
operation to make it easier to back out the file if it contained
errors. But this created unnecessary work of re-adding the same symbols
to the main symtab once everything was validated.
Instead we directly add symbols to the main symbols table. If there is
an error in validation, we remove precisely the set of symbols that
were already added.
This also requires using a separate arena for each file. We can fuse
it with the symtab's main arena if the operation is successful.
LoadDescriptor_Upb 61.2µs ± 4% 53.5µs ± 1% -12.50% (p=0.000 n=12+12)
LoadAdsDescriptor_Upb 4.43ms ± 1% 3.06ms ± 0% -31.00% (p=0.000 n=12+12)
LoadDescriptor_Proto2 257µs ± 0% 259µs ± 0% +1.00% (p=0.000 n=12+12)
LoadAdsDescriptor_Proto2 13.9ms ± 1% 13.9ms ± 1% ~ (p=0.128 n=12+12)
4 years ago
Joshua Haberman
4d9a8cd67b
Merge branch 'master' into symtab-longjmp
4 years ago
Joshua Haberman
6322d1d72d
Merge pull request #329 from haberman/benchmark-ads-descriptor
...
Added benchmark for loading ads descriptor.
4 years ago
Joshua Haberman
5ec1d39224
Avoid building .pb.cc for ads protos, as C++ takes forever to compile.
4 years ago
Joshua Haberman
43c207ea7e
Added CMake dummy rule.
4 years ago
Joshua Haberman
c3b5637646
Added benchmark for loading ads descriptor.
...
Generally this seems to track the speed of loading descriptor.proto.
----------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
----------------------------------------------------------------------------------------------------
BM_LoadDescriptor_Upb 59091 ns 59086 ns 11747 121.182MB/s
BM_LoadAdsDescriptor_Upb 4218587 ns 4218582 ns 166 120.544MB/s
BM_LoadDescriptor_Proto2 241083 ns 241049 ns 2903 29.7043MB/s
BM_LoadAdsDescriptor_Proto2 13442631 ns 13442099 ns 52 34.8975MB/s
4 years ago
Joshua Haberman
acd72c6d3f
WIP.
4 years ago
Joshua Haberman
6ae3b66cd2
Merge pull request #328 from haberman/optdefload
...
Optimized the loading of descriptors
4 years ago
Joshua Haberman
8113ebd6c7
Added explanatory comment about integer constants.
4 years ago
Joshua Haberman
f2d826b9f3
Got rid of floating-point division in table init.
...
Ideally we would get rid of all floating-point operations
in table.c, but that's a job for another day.
4 years ago
Joshua Haberman
723cd8ffc1
Added wyhash code and LICENSE, and removed temporary benchmark.
4 years ago
Joshua Haberman
15e20636c3
Merge branch 'master' into optdefload
4 years ago
Joshua Haberman
994cf07cf3
Merge pull request #327 from benjaminp/modern-linking
...
Migrate to modern Starlark linking api.
4 years ago
Benjamin Peterson
b5bd5807a7
Migrate to modern Starlark linking api.
...
See https://github.com/bazelbuild/bazel/issues/10860 .
4 years ago
Joshua Haberman
901744a97e
Merge pull request #326 from haberman/c99
...
Drop C89/C90 support and MSVC prior to Visual Studio 2015.
4 years ago
Joshua Haberman
a0d16e7073
Added a few missing copts, and made some functions proper prototypes.
4 years ago
Joshua Haberman
558315a1c3
Added COPTS to :port.
4 years ago
Joshua Haberman
7e5bd65098
Plumbed copts (including the crucial -std=c99) to upb_proto_library() aspect.
4 years ago
Joshua Haberman
8f3ee80d46
Drop C89/C90 support and MSVC prior to Visual Studio 2015.
...
upb previously attempted to support C89 and pre-2015 versions
of Visual Studio. This was to support older compilers with
limited C99 support (particularly MSVC). But as of last August,
even gRPC has dropped support for MSVC prior to 2015
c87276d058
Therefore it seems safe for upb to no longer attempt C89 support
(we were already not truly C89 compliant, with our use of "bool").
We now explicitly require C99 or greater and MSVC 2015 or greater.
This cleaned up port_def.inc a fair bit. I took the chance to
also remove some obsolete macros.
4 years ago
Joshua Haberman
0756999ab6
Merge pull request #325 from haberman/inlined-arena
...
Fixed upb::InlinedArena, which was completely broken.
4 years ago
Joshua Haberman
25db40bc30
Fixed upb::InlinedArena, which was compeltely broken.
4 years ago
Joshua Haberman
1bd62e8218
Merge pull request #324 from haberman/simplemomi
...
Eliminated bounds checks inside parsing a field.
4 years ago
Joshua Haberman
f4adbe0698
Optimized varint decoding from Gerben.
...
This speeds things up but costs some code size.
name old time/op new time/op delta
ArenaOneAlloc 21.1ns ± 0% 21.3ns ± 0% +1.33% (p=0.000 n=12+12)
ArenaInitialBlockOneAlloc 6.02ns ± 0% 6.02ns ± 0% ~ (p=0.579 n=10+10)
LoadDescriptor_Upb 111µs ± 1% 110µs ± 1% -0.91% (p=0.003 n=11+12)
LoadDescriptor_Proto2 258µs ± 1% 258µs ± 1% ~ (p=0.674 n=10+12)
Parse_Upb_FileDesc_WithArena 11.2µs ± 0% 10.4µs ± 0% -6.67% (p=0.000 n=12+12)
Parse_Upb_FileDesc_WithInitialBlock 10.6µs ± 0% 10.1µs ± 0% -4.48% (p=0.000 n=12+11)
SerializeDescriptor_Proto2 5.36µs ± 5% 5.36µs ± 3% ~ (p=0.880 n=12+11)
SerializeDescriptor_Upb 11.9µs ± 0% 12.0µs ± 0% +0.81% (p=0.000 n=12+12)
FILE SIZE VM SIZE
-------------- --------------
+23% +1.11Ki +24% +1.06Ki upb/decode.c
+15% +560 +15% +560 decode_msg
+140% +240 +188% +240 decode_longvarint64
[NEW] +174 [NEW] +128 decode_isdonefallback
+56% +160 +65% +160 upb_decode
-49.7% -1.06Ki [ = ] 0 [Unmapped]
+0.0% +48 +0.9% +1.06Ki TOTAL
4 years ago
Joshua Haberman
48689df72e
Eliminated bounds checks inside parsing a field.
...
Each field parser gets 16 bytes of slop. This requires using a patch
buffer at end-of-buffer.
This addes 80% of what is needed to support a pull parser with a data
callback, since the main parser is now tolerant to buffer flips.
There is a ~4% performance regression and 12% code size regression in
upb/decode.c:
name old time/op new time/op delta
ArenaOneAlloc 21.0ns ± 0% 21.6ns ± 0% +2.87% (p=0.000 n=12+12)
ArenaInitialBlockOneAlloc 6.02ns ± 0% 6.02ns ± 0% +0.09% (p=0.001 n=11+12)
LoadDescriptor_Upb 114µs ± 1% 115µs ± 1% +0.96% (p=0.000 n=11+12)
LoadDescriptor_Proto2 260µs ± 1% 261µs ± 1% +0.55% (p=0.033 n=12+12)
Parse_Upb_FileDesc_WithArena 10.8µs ± 0% 11.2µs ± 0% +3.43% (p=0.000 n=11+11)
Parse_Upb_FileDesc_WithInitialBlock 10.5µs ± 0% 10.9µs ± 0% +3.68% (p=0.000 n=12+12)
SerializeDescriptor_Proto2 5.25µs ± 3% 5.42µs ± 5% +3.39% (p=0.007 n=12+12)
SerializeDescriptor_Upb 12.0µs ± 0% 12.5µs ± 0% +4.14% (p=0.000 n=12+11)
FILE SIZE VM SIZE
-------------- --------------
+12% +606 +12% +560 upb/decode.c
+7.9% +288 +7.9% +288 decode_msg
[NEW] +174 [NEW] +128 decode_isdonefallback
+56% +160 +65% +160 upb_decode
-9.3% -16 -12.5% -16 decode_longvarint64
-25.5% -558 [ = ] 0 [Unmapped]
+0.0% +48 +0.4% +560 TOTAL
4 years ago
Joshua Haberman
a7e2e8338d
Fixed benchmark script.
4 years ago
Joshua Haberman
b86cf2d789
Merge pull request #323 from haberman/build-files
...
Split monolithic BUILD file into many build files.
4 years ago
Joshua Haberman
4ea81ab107
Fixed pedantic warning.
4 years ago
Joshua Haberman
6399b31f4b
Removed ULL constants in json_decode.c.
4 years ago
Joshua Haberman
c8ae197e64
Removed "U" suffixes, they are not necessary.
4 years ago
Joshua Haberman
bc1e0b314f
Fixed some strict C89 errors.
4 years ago
Joshua Haberman
2c1664906a
Removed license comments and upb_amalgamation for google3.
4 years ago
Joshua Haberman
b7dc77415a
Added licenses() to all BUILD files.
4 years ago
Joshua Haberman
de22764b33
Updated Kokoro to test ... instead of :all.
4 years ago
Joshua Haberman
e3f41de6c7
Split monolithic BUILD file into many build files.
4 years ago
Joshua Haberman
4f066765a9
Merge pull request #320 from haberman/string-view-benchmark
...
Added a benchmark for ctype=STRING_PIECE
4 years ago
Joshua Haberman
bf393bf086
Cleaned up benchmark names.
4 years ago
Joshua Haberman
9eb8414b31
Added descriptor_sv.proto.
4 years ago
Joshua Haberman
ee7da95367
Bzl formatting fix per buildifier.
4 years ago
Joshua Haberman
de1b6b0718
Refactored proto2 benchmarks and added StringView benchmark.
4 years ago
Joshua Haberman
52721eadc7
Order LargeInitialBlock after non-initial-block test.
4 years ago
Joshua Haberman
d225dfc2ed
Buildifier formatting fixes.
4 years ago
Joshua Haberman
b0994a6501
Added missing dep from benchmark.
4 years ago
Joshua Haberman
de80054018
Make required fields optional for benchmarking.
4 years ago
Joshua Haberman
11585095b7
Merge pull request #319 from haberman/copy-descriptor
...
Snapshot descriptor.proto into our own copy for benchmarking purposes.
4 years ago
Joshua Haberman
fd5a35d49d
Minor comment changes.
4 years ago
Joshua Haberman
bdd1a516e8
Fixed other tests.
4 years ago
Joshua Haberman
27262adf93
Snapshot descriptor.proto into our own copy for benchmarking purposes.
...
This will ensure that the schema and payload are constant across
time and space.
4 years ago
Joshua Haberman
d6b40fd5e2
Added missing dependency on reflection.
4 years ago
Joshua Haberman
4f901b6430
Passes all tests.
4 years ago