Tag:
Branch:
Tree:
5f1e1d72fc
21.x
22.x
22.x-202303072154
22.x-202304122338
23.0-rc2-patch
23.x
23.x-202305051714
23.x-202305081751
23.x-202305171614
24.x
25.x
25.x-202311012212
25.x-allow-compat-test
25.x-compat-tests
25.x-compat-upgrade
26.x
27.x
28.x
28.x-202408082011
28.x-202409182056
29.x
3.0.x
3.1.x
3.10.x
3.11.x
3.12.x
3.13.x
3.14.x
3.15.x
3.16.x
3.17.x
3.18.x
3.19.x
3.2.x
3.20.x
3.3.x
3.5.x
3.6.x
3.7.x
3.8.x
3.9.x
4.0.x
add-support-for-options-in-ruby
add_missing_headers
b7-all
bazel-rules
bazel-rules2
bazel7-deb11
bcr
bootstrap_upb_fix
burndown_patches
bzlmod
cherrypickStatic
cherrypicks
cp-bzl
cp-java-feature-bootstrap
cp-java-generator
cp-segv
deannagarcia-patch-1
deannagarcia-patch-10
deannagarcia-patch-11
deannagarcia-patch-12
deannagarcia-patch-2
deannagarcia-patch-3
deannagarcia-patch-4
deannagarcia-patch-5
deannagarcia-patch-6
deannagarcia-patch-7
deannagarcia-patch-8
deannagarcia-patch-9
delete-internal-files
disable-upload-artifacts-action
dmaclach-mach_absolute_time
editions-27
ffi-fix
fix-25.x-staleness
fix_jruby_proto3_optional
gha
gha-actions
gha-migration
gha-migration2
gha-migration3
gha-test
ghaPassFail
java8
jruby_9.4.6.0
main
main-202302161846
main-202303072257
main-202304252156
main-202305082101
main-202310162054
main-202401251548
main-202404180211
main-202407112335
main-202409302244
main-tmp-1
main-tmp-2
main-tmp-3
main-tmp-test-branch
mavenTests
php-regen
pkgconfig2-22
pomTrial
reenable_cruby_ffi_tests
regen-upb
revert-12721-main-202305082101
revert-18339-bazel-rules2
rm-php-compat-code
ruby-ffi-freezing
ruby-json-pool-fix
ruby-rm-syntax
ruby_artifact_uploads
ruby_dep
set-ex-test
shaod2-patch-1
support_ruby_3.4.x
test_458711847
test_472529298
test_477475045
test_488676475
test_488736123
test_488863171
test_488996168
test_489037129
test_489075734
test_489259176
test_490412672
test_490480534
test_490544827
test_490775181
test_491410618
test_492007398
test_492047164
test_492051638
test_492365076
test_492380119
test_493086551
test_493088412
test_493584811
test_493743618
test_493886620
test_494027573
test_494043842
test_494271758
test_494398568
test_494723105
test_494824070
test_494835245
test_495003404
test_495019683
test_495043824
test_495125557
test_495293733
test_495294072
test_495352403
test_495412624
test_495507057
test_500390065
test_559560115
test_673637686
test_688236375
test_690747142
test_694296172
test_695874999
test_695907097
test_696193936
test_696314735
test_696627666
test_696648468
test_696653406
test_696685663
test_696996787
test_697057326
test_697064024
test_697519418
test_697543962
test_697570239
test_697675982
test_697733985
test_697737595
test_697740279
test_698127760
test_698146211
test_698366909
test_698390064
test_698410801
test_698427292
test_698449789
test_698470722
test_698483682
test_698517877
test_698524915
test_kfm
test_ruby
win2019-23.x
zhangskz-patch-1
3.15.0-rc1
conformance-build-tag
v16.2
v18.3
v19.5
v2.4.1
v2.5.0
v2.6.0
v2.6.1
v2.6.1rc1
v20.2
v21.0
v21.0-rc1
v21.0-rc2
v21.1
v21.10
v21.11
v21.12
v21.2
v21.3
v21.4
v21.5
v21.6
v21.7
v21.8
v21.9
v22.0
v22.0-rc1
v22.0-rc2
v22.0-rc3
v22.1
v22.2
v22.3
v22.4
v22.5
v23.0
v23.0-rc1
v23.0-rc2
v23.0-rc3
v23.1
v23.2
v23.3
v23.4
v24.0
v24.0-rc1
v24.0-rc2
v24.0-rc3
v24.1
v24.2
v24.3
v24.4
v25.0
v25.0-rc1
v25.0-rc2
v25.1
v25.2
v25.3
v25.4
v25.5
v26-dev
v26.0
v26.0-rc1
v26.0-rc2
v26.0-rc3
v26.1
v27-dev
v27.0
v27.0-rc1
v27.0-rc2
v27.0-rc3
v27.1
v27.2
v27.3
v27.4
v27.5
v28-dev
v28.0
v28.0-rc1
v28.0-rc2
v28.0-rc3
v28.1
v28.2
v28.3
v29-dev
v29.0-rc1
v29.0-rc2
v29.0-rc3
v3.0.0
v3.0.0-alpha-1
v3.0.0-alpha-2
v3.0.0-alpha-3
v3.0.0-alpha-3.1
v3.0.0-alpha-4
v3.0.0-alpha-4.1
v3.0.0-beta-1
v3.0.0-beta-1-bzl-fix
v3.0.0-beta-1.1
v3.0.0-beta-2
v3.0.0-beta-3
v3.0.0-beta-3-pre-1
v3.0.0-beta-3.1
v3.0.0-beta-3.2
v3.0.0-beta-3.3
v3.0.0-beta-4
v3.0.0-javalite
v3.0.1-javalite
v3.0.2
v3.1.0
v3.1.0-alpha-1
v3.10.0
v3.10.0-rc1
v3.10.1
v3.11.0
v3.11.0-rc1
v3.11.0-rc2
v3.11.1
v3.11.2
v3.11.3
v3.11.4
v3.12.0
v3.12.0-rc1
v3.12.0-rc2
v3.12.1
v3.12.2
v3.12.3
v3.12.4
v3.13.0
v3.13.0-rc3
v3.13.0.1
v3.14.0
v3.14.0-rc1
v3.14.0-rc2
v3.14.0-rc3
v3.15.0
v3.15.0-rc1
v3.15.0-rc2
v3.15.1
v3.15.2
v3.15.3
v3.15.4
v3.15.5
v3.15.6
v3.15.7
v3.15.8
v3.16.0
v3.16.0-rc1
v3.16.0-rc2
v3.16.1
v3.16.2
v3.16.3
v3.17.0
v3.17.0-rc1
v3.17.0-rc2
v3.17.1
v3.17.2
v3.17.3
v3.18.0
v3.18.0-rc1
v3.18.0-rc2
v3.18.1
v3.18.2
v3.18.3
v3.19.0
v3.19.0-rc1
v3.19.0-rc2
v3.19.1
v3.19.2
v3.19.3
v3.19.4
v3.19.5
v3.19.6
v3.2.0
v3.2.0-alpha-1
v3.2.0-rc.1
v3.2.0rc2
v3.2.1
v3.20.0
v3.20.0-rc1
v3.20.0-rc2
v3.20.0-rc3
v3.20.1
v3.20.1-rc1
v3.20.2
v3.20.3
v3.21.0
v3.21.0-rc2
v3.21.1
v3.21.10
v3.21.11
v3.21.12
v3.21.2
v3.21.3
v3.21.4
v3.21.5
v3.21.6
v3.21.7
v3.21.8
v3.21.9
v3.22.0
v3.22.0-rc1
v3.22.0-rc2
v3.22.0-rc3
v3.22.1
v3.22.2
v3.22.3
v3.22.4
v3.22.5
v3.23.0
v3.23.0-rc1
v3.23.0-rc2
v3.23.0-rc3
v3.23.1
v3.23.2
v3.23.3
v3.23.4
v3.24.0
v3.24.0-rc1
v3.24.0-rc2
v3.24.0-rc3
v3.24.1
v3.24.2
v3.24.3
v3.24.4
v3.25.0
v3.25.0-rc1
v3.25.0-rc2
v3.25.1
v3.25.2
v3.25.3
v3.25.4
v3.25.5
v3.26.0
v3.26.0-rc1
v3.26.0-rc2
v3.26.0-rc3
v3.26.1
v3.27.0
v3.27.0-rc1
v3.27.0-rc2
v3.27.0-rc3
v3.27.1
v3.27.2
v3.27.3
v3.27.4
v3.27.5
v3.28.0
v3.28.0-rc1
v3.28.0-rc2
v3.28.0-rc3
v3.28.1
v3.28.2
v3.28.3
v3.29.0-rc1
v3.29.0-rc2
v3.29.0-rc3
v3.3.0
v3.3.0rc1
v3.3.1
v3.3.2
v3.4.0
v3.4.0rc1
v3.4.0rc2
v3.4.0rc3
v3.4.1
v3.5.0
v3.5.0.1
v3.5.1
v3.5.1.1
v3.5.2
v3.6.0
v3.6.0.1
v3.6.0rc1
v3.6.0rc2
v3.6.1
v3.6.1.1
v3.6.1.2
v3.6.1.3
v3.7.0
v3.7.0-rc.2
v3.7.0-rc.3
v3.7.0rc1
v3.7.0rc2
v3.7.1
v3.8.0
v3.8.0-rc1
v3.9.0
v3.9.0-rc1
v3.9.1
v3.9.2
v4.22.0
v4.22.0-rc1
v4.22.0-rc2
v4.22.0-rc3
v4.22.1
v4.22.2
v4.22.3
v4.22.4
v4.22.5
v4.23.0
v4.23.0-rc1
v4.23.0-rc2
v4.23.0-rc3
v4.23.1
v4.23.2
v4.23.3
v4.23.4
v4.24.0
v4.24.0-rc1
v4.24.0-rc2
v4.24.0-rc3
v4.24.1
v4.24.2
v4.24.3
v4.24.4
v4.25.0
v4.25.0-rc1
v4.25.0-rc2
v4.25.1
v4.25.2
v4.25.3
v4.25.4
v4.25.5
v5.26.0
v5.26.0-rc1
v5.26.0-rc2
v5.26.0-rc3
v5.26.1
v5.27.0
v5.27.0-rc1
v5.27.0-rc2
v5.27.0-rc3
v5.27.1
v5.27.2
v5.27.3
v5.27.4
v5.27.5
v5.28.0
v5.28.0-rc1
v5.28.0-rc2
v5.28.0-rc3
v5.28.1
v5.28.2
v5.28.3
v5.29.0-rc1
v5.29.0-rc2
v5.29.0-rc3
${ noResults }
6 Commits (5f1e1d72fc27927a32fbbb7937f23f25e64f1e22)
Author | SHA1 | Message | Date |
---|---|---|---|
Adam Cozzette | 4ec9170bcd |
Fix layering check for usage of gtest
To satisfy the layering check, we need to depend on :gtest for the headers, in addition to :gtest_main which provides the main() function. There are a bunch of formatting changes as a side effect of this, but they should be harmless. PiperOrigin-RevId: 594318263 |
11 months ago |
Joshua Haberman | 238538b6ce |
Fixed breaking ARM tests by properly aligning default options.
This char array is interpreted as a proto, so it needs pointer alignment at least. PiperOrigin-RevId: 592935088 |
11 months ago |
Eric Salo | bb5322a194 |
upb: lock down upb_MiniTable (mostly)
PiperOrigin-RevId: 586542236 |
1 year ago |
Joshua Haberman | c69dd68fb1 |
Implement feature inheritance and legacy editions for upb.
This switches upb to using legacy editions for all proto2/proto3 logic. This does not yet enable code generation for editions protos (ie. we do not yet turn on `FEATURE_SUPPORTS_EDITIONS`), but with feature inheritance in place, this will be a much smaller follow-on change. There is a ~10% increase in allocations, but only a ~1% increase in peak memory. There are some <5% increases in instructions and cycles, but apparently no increase in time: ``` name old cpu/op new cpu/op delta BM_ArenaOneAlloc 17.8ns ±11% 16.9ns ±17% ~ (p=0.310 n=5+5) BM_ArenaInitialBlockOneAlloc 5.99ns ±13% 5.35ns ± 2% ~ (p=0.421 n=5+5) BM_ArenaFuseUnbalanced/2 71.4ns ±11% 63.1ns ± 3% ~ (p=0.095 n=5+5) BM_ArenaFuseUnbalanced/8 509ns ± 2% 532ns ±15% ~ (p=0.421 n=5+5) BM_ArenaFuseUnbalanced/64 4.73µs ±20% 4.43µs ±10% ~ (p=0.841 n=5+5) BM_ArenaFuseUnbalanced/128 9.77µs ±12% 8.64µs ± 4% ~ (p=0.095 n=5+5) BM_ArenaFuseBalanced/2 67.5ns ±13% 62.6ns ± 3% ~ (p=0.841 n=5+5) BM_ArenaFuseBalanced/8 552ns ±23% 496ns ±25% ~ (p=0.222 n=5+5) BM_ArenaFuseBalanced/64 4.76µs ±14% 4.24µs ± 4% ~ (p=0.421 n=5+5) BM_ArenaFuseBalanced/128 10.2µs ±14% 8.6µs ± 4% -15.61% (p=0.016 n=5+5) BM_LoadAdsDescriptor_Upb<NoLayout> 6.20ms ±12% 6.18ms ±16% ~ (p=0.421 n=5+5) BM_LoadAdsDescriptor_Upb<WithLayout> 6.91ms ±12% 6.63ms ± 3% ~ (p=0.690 n=5+5) BM_LoadAdsDescriptor_Proto2<NoLayout> 15.0ms ±12% 13.7ms ± 3% ~ (p=0.421 n=5+5) BM_LoadAdsDescriptor_Proto2<WithLayout> 15.1ms ±13% 13.8ms ± 3% ~ (p=0.548 n=5+5) BM_Parse_Upb_FileDesc<UseArena, Copy> 14.4µs ±13% 13.2µs ± 3% ~ (p=0.548 n=5+5) BM_Parse_Upb_FileDesc<UseArena, Alias> 12.8µs ±12% 11.8µs ± 3% ~ (p=0.222 n=5+5) BM_Parse_Upb_FileDesc<InitBlock, Copy> 13.7µs ±12% 12.9µs ± 3% ~ (p=1.000 n=5+5) BM_Parse_Upb_FileDesc<InitBlock, Alias> 13.1µs ±11% 11.6µs ± 3% ~ (p=0.056 n=5+5) BM_Parse_Proto2<FileDesc, NoArena, Copy> 24.7µs ±12% 22.6µs ± 8% ~ (p=0.310 n=5+5) BM_Parse_Proto2<FileDesc, UseArena, Copy> 11.6µs ±13% 10.9µs ± 2% ~ (p=1.000 n=5+5) BM_Parse_Proto2<FileDesc, InitBlock, Copy> 11.7µs ±10% 10.6µs ± 3% ~ (p=0.310 n=5+5) BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 13.4µs ±12% 12.3µs ± 4% ~ (p=0.310 n=5+5) BM_SerializeDescriptor_Proto2 6.62µs ±13% 6.00µs ± 6% ~ (p=0.056 n=5+5) BM_SerializeDescriptor_Upb 11.1µs ±13% 10.3µs ± 3% ~ (p=1.000 n=5+5) name old time/op new time/op delta BM_ArenaOneAlloc 17.9ns ±12% 17.0ns ±17% ~ (p=0.310 n=5+5) BM_ArenaInitialBlockOneAlloc 6.03ns ±14% 5.36ns ± 2% ~ (p=0.421 n=5+5) BM_ArenaFuseUnbalanced/2 71.9ns ±12% 63.3ns ± 3% ~ (p=0.095 n=5+5) BM_ArenaFuseUnbalanced/8 511ns ± 2% 533ns ±15% ~ (p=0.421 n=5+5) BM_ArenaFuseUnbalanced/64 4.75µs ±20% 4.44µs ±10% ~ (p=0.841 n=5+5) BM_ArenaFuseUnbalanced/128 9.83µs ±12% 8.66µs ± 4% ~ (p=0.151 n=5+5) BM_ArenaFuseBalanced/2 67.8ns ±13% 62.7ns ± 3% ~ (p=0.841 n=5+5) BM_ArenaFuseBalanced/8 555ns ±24% 497ns ±26% ~ (p=0.222 n=5+5) BM_ArenaFuseBalanced/64 4.79µs ±14% 4.25µs ± 4% ~ (p=0.310 n=5+5) BM_ArenaFuseBalanced/128 10.3µs ±14% 8.6µs ± 4% -15.93% (p=0.016 n=5+5) BM_LoadAdsDescriptor_Upb<NoLayout> 6.25ms ±12% 6.20ms ±16% ~ (p=0.421 n=5+5) BM_LoadAdsDescriptor_Upb<WithLayout> 6.96ms ±13% 6.65ms ± 3% ~ (p=0.690 n=5+5) BM_LoadAdsDescriptor_Proto2<NoLayout> 15.2ms ±12% 13.7ms ± 3% ~ (p=0.421 n=5+5) BM_LoadAdsDescriptor_Proto2<WithLayout> 15.3ms ±14% 13.8ms ± 3% ~ (p=0.548 n=5+5) BM_Parse_Upb_FileDesc<UseArena, Copy> 14.5µs ±14% 13.2µs ± 3% ~ (p=0.690 n=5+5) BM_Parse_Upb_FileDesc<UseArena, Alias> 12.8µs ±12% 11.8µs ± 3% ~ (p=0.222 n=5+5) BM_Parse_Upb_FileDesc<InitBlock, Copy> 13.8µs ±13% 13.0µs ± 3% ~ (p=1.000 n=5+5) BM_Parse_Upb_FileDesc<InitBlock, Alias> 13.2µs ±12% 11.6µs ± 3% ~ (p=0.056 n=5+5) BM_Parse_Proto2<FileDesc, NoArena, Copy> 24.9µs ±12% 22.6µs ± 8% ~ (p=0.310 n=5+5) BM_Parse_Proto2<FileDesc, UseArena, Copy> 11.7µs ±14% 10.9µs ± 2% ~ (p=1.000 n=5+5) BM_Parse_Proto2<FileDesc, InitBlock, Copy> 11.7µs ±11% 10.7µs ± 3% ~ (p=0.222 n=5+5) BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 13.5µs ±12% 12.3µs ± 4% ~ (p=0.310 n=5+5) BM_SerializeDescriptor_Proto2 6.65µs ±13% 6.01µs ± 6% ~ (p=0.056 n=5+5) BM_SerializeDescriptor_Upb 11.2µs ±13% 10.3µs ± 3% ~ (p=1.000 n=5+5) name old INSTRUCTIONS/op new INSTRUCTIONS/op delta BM_ArenaOneAlloc 189 ± 0% 189 ± 0% ~ (p=0.881 n=5+5) BM_ArenaInitialBlockOneAlloc 69.0 ± 0% 69.0 ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/2 458 ± 0% 458 ± 0% ~ (p=1.000 n=5+5) BM_ArenaFuseUnbalanced/8 3.28k ±15% 3.60k ± 0% ~ (p=0.286 n=5+4) BM_ArenaFuseUnbalanced/64 28.6k ± 2% 29.2k ± 0% +2.17% (p=0.032 n=5+4) BM_ArenaFuseUnbalanced/128 57.9k ± 1% 57.9k ± 1% ~ (p=1.000 n=5+5) BM_ArenaFuseBalanced/2 482 ± 0% 482 ± 0% ~ (p=0.421 n=5+5) BM_ArenaFuseBalanced/8 3.35k ±14% 3.35k ±14% ~ (p=0.841 n=5+5) BM_ArenaFuseBalanced/64 29.2k ± 2% 29.3k ± 1% ~ (p=0.421 n=5+5) BM_ArenaFuseBalanced/128 59.2k ± 1% 59.3k ± 1% ~ (p=0.556 n=4+5) BM_LoadAdsDescriptor_Upb<NoLayout> 37.3M ± 0% 38.2M ± 0% +2.39% (p=0.008 n=5+5) BM_LoadAdsDescriptor_Upb<WithLayout> 40.9M ± 0% 41.7M ± 0% +2.02% (p=0.008 n=5+5) BM_LoadAdsDescriptor_Proto2<NoLayout> 87.2M ± 0% 88.3M ± 1% +1.25% (p=0.008 n=5+5) BM_LoadAdsDescriptor_Proto2<WithLayout> 88.0M ± 0% 88.9M ± 1% +1.13% (p=0.016 n=5+5) BM_Parse_Upb_FileDesc<UseArena, Copy> 154k ± 0% 154k ± 0% ~ (p=1.000 n=5+5) BM_Parse_Upb_FileDesc<UseArena, Alias> 143k ± 0% 143k ± 0% ~ (p=0.310 n=5+5) BM_Parse_Upb_FileDesc<InitBlock, Copy> 153k ± 0% 153k ± 0% ~ (p=1.016 n=5+4) BM_Parse_Upb_FileDesc<InitBlock, Alias> 142k ± 0% 142k ± 0% ~ (p=0.127 n=5+5) BM_Parse_Proto2<FileDesc, NoArena, Copy> 213k ± 1% 217k ± 5% ~ (p=1.000 n=5+5) BM_Parse_Proto2<FileDesc, UseArena, Copy> 122k ± 0% 123k ± 0% +0.86% (p=0.008 n=5+5) BM_Parse_Proto2<FileDesc, InitBlock, Copy> 120k ± 0% 120k ± 0% ~ (p=0.421 n=5+5) BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 124k ± 0% 124k ± 0% ~ (p=0.587 n=5+5) BM_SerializeDescriptor_Proto2 63.5k ± 0% 63.5k ± 0% ~ (p=0.278 n=5+5) BM_SerializeDescriptor_Upb 111k ± 0% 111k ± 0% ~ (p=1.000 n=5+5) name old CYCLES/op new CYCLES/op delta BM_ArenaOneAlloc 53.5 ± 0% 53.4 ± 0% ~ (p=0.095 n=5+5) BM_ArenaInitialBlockOneAlloc 17.5 ± 1% 17.4 ± 0% ~ (p=0.087 n=5+5) BM_ArenaFuseUnbalanced/2 206 ± 0% 206 ± 0% ~ (p=0.548 n=5+5) BM_ArenaFuseUnbalanced/8 1.55k ±12% 1.67k ± 1% ~ (p=0.548 n=5+5) BM_ArenaFuseUnbalanced/64 14.1k ± 8% 14.1k ± 1% ~ (p=0.222 n=5+5) BM_ArenaFuseUnbalanced/128 28.2k ± 1% 28.3k ± 1% ~ (p=0.548 n=5+5) BM_ArenaFuseBalanced/2 205 ± 0% 204 ± 0% ~ (p=0.548 n=5+5) BM_ArenaFuseBalanced/8 1.57k ±12% 1.56k ±12% ~ (p=0.421 n=5+5) BM_ArenaFuseBalanced/64 13.9k ± 2% 13.9k ± 1% ~ (p=1.000 n=5+5) BM_ArenaFuseBalanced/128 28.1k ± 1% 28.2k ± 1% ~ (p=0.730 n=4+5) BM_LoadAdsDescriptor_Upb<NoLayout> 18.7M ± 0% 19.3M ± 1% +3.38% (p=0.008 n=5+5) BM_LoadAdsDescriptor_Upb<WithLayout> 20.9M ± 0% 21.6M ± 0% +3.09% (p=0.008 n=5+5) BM_LoadAdsDescriptor_Proto2<NoLayout> 43.4M ± 0% 44.4M ± 1% +2.33% (p=0.008 n=5+5) BM_LoadAdsDescriptor_Proto2<WithLayout> 44.0M ± 0% 44.9M ± 2% +1.92% (p=0.016 n=5+5) BM_Parse_Upb_FileDesc<UseArena, Copy> 42.0k ± 1% 43.0k ± 1% +2.32% (p=0.008 n=5+5) BM_Parse_Upb_FileDesc<UseArena, Alias> 38.2k ± 1% 38.4k ± 0% +0.74% (p=0.032 n=5+5) BM_Parse_Upb_FileDesc<InitBlock, Copy> 41.6k ± 0% 42.6k ± 1% +2.51% (p=0.008 n=5+5) BM_Parse_Upb_FileDesc<InitBlock, Alias> 37.6k ± 0% 38.1k ± 0% +1.34% (p=0.008 n=5+5) BM_Parse_Proto2<FileDesc, NoArena, Copy> 71.9k ± 1% 74.1k ± 6% ~ (p=1.000 n=5+5) BM_Parse_Proto2<FileDesc, UseArena, Copy> 35.4k ± 1% 35.8k ± 0% +1.10% (p=0.008 n=5+5) BM_Parse_Proto2<FileDesc, InitBlock, Copy> 34.6k ± 1% 34.9k ± 1% ~ (p=0.095 n=5+5) BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 40.5k ± 0% 40.0k ± 1% -1.36% (p=0.008 n=5+5) BM_SerializeDescriptor_Proto2 20.1k ± 1% 19.7k ± 4% ~ (p=0.421 n=5+5) BM_SerializeDescriptor_Upb 33.7k ± 0% 33.7k ± 0% ~ (p=0.222 n=5+5) name old allocs/op new allocs/op delta BM_ArenaOneAlloc 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/2 2.00 ± 0% 2.00 ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/8 8.00 ± 0% 8.00 ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/64 64.0 ± 0% 64.0 ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/128 128 ± 0% 128 ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/2 2.00 ± 0% 2.00 ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/8 8.00 ± 0% 8.00 ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/64 64.0 ± 0% 64.0 ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/128 128 ± 0% 128 ± 0% ~ (all samples are equal) BM_LoadAdsDescriptor_Upb<NoLayout> 6.21k ± 0% 6.93k ± 0% +11.54% (p=0.008 n=5+5) BM_LoadAdsDescriptor_Upb<WithLayout> 6.54k ± 0% 6.96k ± 0% +6.34% (p=0.008 n=5+5) BM_LoadAdsDescriptor_Proto2<NoLayout> 124k ± 0% 124k ± 0% +0.00% (p=0.008 n=5+5) BM_LoadAdsDescriptor_Proto2<WithLayout> 126k ± 0% 126k ± 0% +0.00% (p=0.008 n=5+5) BM_Parse_Upb_FileDesc<UseArena, Copy> 7.00 ± 0% 7.00 ± 0% ~ (all samples are equal) BM_Parse_Upb_FileDesc<UseArena, Alias> 7.00 ± 0% 7.00 ± 0% ~ (all samples are equal) BM_Parse_Proto2<FileDesc, NoArena, Copy> 709 ± 0% 709 ± 0% ~ (all samples are equal) BM_Parse_Proto2<FileDesc, UseArena, Copy> 8.00 ± 0% 8.00 ± 0% ~ (all samples are equal) name old peak-mem(Bytes)/op new peak-mem(Bytes)/op delta BM_ArenaOneAlloc 328 ± 0% 328 ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/2 656 ± 0% 656 ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/8 2.62k ± 0% 2.62k ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/64 21.0k ± 0% 21.0k ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/128 42.0k ± 0% 42.0k ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/2 656 ± 0% 656 ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/8 2.62k ± 0% 2.62k ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/64 21.0k ± 0% 21.0k ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/128 42.0k ± 0% 42.0k ± 0% ~ (all samples are equal) BM_LoadAdsDescriptor_Upb<NoLayout> 10.2M ± 0% 10.4M ± 0% +1.15% (p=0.008 n=5+5) BM_LoadAdsDescriptor_Upb<WithLayout> 10.5M ± 0% 10.5M ± 0% +0.11% (p=0.008 n=5+5) BM_LoadAdsDescriptor_Proto2<NoLayout> 7.14M ± 0% 7.14M ± 0% ~ (p=0.317 n=4+5) BM_LoadAdsDescriptor_Proto2<WithLayout> 7.18M ± 0% 7.18M ± 0% ~ (p=0.159 n=5+4) BM_Parse_Upb_FileDesc<UseArena, Copy> 36.5k ± 0% 36.5k ± 0% ~ (all samples are equal) BM_Parse_Upb_FileDesc<UseArena, Alias> 36.5k ± 0% 36.5k ± 0% ~ (all samples are equal) BM_Parse_Proto2<FileDesc, NoArena, Copy> 35.4k ± 0% 35.4k ± 0% ~ (all samples are equal) BM_Parse_Proto2<FileDesc, UseArena, Copy> 65.3k ± 0% 65.3k ± 0% ~ (all samples are equal) name old items/s new items/s delta BM_ArenaFuseUnbalanced/2 28.2M ±12% 31.7M ± 3% ~ (p=0.095 n=5+5) BM_ArenaFuseUnbalanced/8 15.7M ± 2% 15.1M ±14% ~ (p=0.421 n=5+5) BM_ArenaFuseUnbalanced/64 13.7M ±18% 14.5M ± 9% ~ (p=0.841 n=5+5) BM_ArenaFuseUnbalanced/128 13.2M ±12% 14.8M ± 5% ~ (p=0.095 n=5+5) BM_ArenaFuseBalanced/2 29.9M ±12% 32.0M ± 3% ~ (p=0.841 n=5+5) BM_ArenaFuseBalanced/8 14.8M ±28% 16.5M ±22% ~ (p=0.222 n=5+5) BM_ArenaFuseBalanced/64 13.6M ±15% 15.1M ± 4% ~ (p=0.421 n=5+5) BM_ArenaFuseBalanced/128 12.6M ±15% 14.9M ± 4% +17.88% (p=0.016 n=5+5) name old speed new speed delta BM_LoadAdsDescriptor_Upb<NoLayout> 128MB/s ±11% 128MB/s ±14% ~ (p=0.421 n=5+5) BM_LoadAdsDescriptor_Upb<WithLayout> 115MB/s ±12% 119MB/s ± 3% ~ (p=0.690 n=5+5) BM_LoadAdsDescriptor_Proto2<NoLayout> 52.9MB/s ±12% 57.6MB/s ± 3% ~ (p=0.421 n=5+5) BM_LoadAdsDescriptor_Proto2<WithLayout> 52.6MB/s ±14% 57.2MB/s ± 2% ~ (p=0.548 n=5+5) BM_Parse_Upb_FileDesc<UseArena, Copy> 527MB/s ±14% 571MB/s ± 3% ~ (p=0.548 n=5+5) BM_Parse_Upb_FileDesc<UseArena, Alias> 595MB/s ±11% 640MB/s ± 3% ~ (p=0.222 n=5+5) BM_Parse_Upb_FileDesc<InitBlock, Copy> 553MB/s ±12% 582MB/s ± 3% ~ (p=1.000 n=5+5) BM_Parse_Upb_FileDesc<InitBlock, Alias> 576MB/s ±12% 649MB/s ± 3% ~ (p=0.056 n=5+5) BM_Parse_Proto2<FileDesc, NoArena, Copy> 307MB/s ±13% 334MB/s ± 8% ~ (p=0.310 n=5+5) BM_Parse_Proto2<FileDesc, UseArena, Copy> 653MB/s ±13% 689MB/s ± 2% ~ (p=1.000 n=5+5) BM_Parse_Proto2<FileDesc, InitBlock, Copy> 650MB/s ±10% 708MB/s ± 3% ~ (p=0.310 n=5+5) BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 564MB/s ±12% 614MB/s ± 4% ~ (p=0.310 n=5+5) BM_SerializeDescriptor_Proto2 1.15GB/s ±12% 1.25GB/s ± 5% ~ (p=0.056 n=5+5) BM_SerializeDescriptor_Upb 684MB/s ±12% 730MB/s ± 3% ~ (p=1.000 n=5+5) ``` This adds about 5Ki of code size. Some of this likely comes from the fact that we now link in `message/copy.c` to perform a deep copy of a FeatureSet proto. ``` $ /google/bin/releases/protobuf-team/bloaty/bloaty-google3-diff --blaze-build-opts="-c opt" third_party/upb/upb/conformance/conformance_upb FILE SIZE VM SIZE -------------- -------------- +0.5% +4.19Ki +0.5% +4.19Ki .text +0.4% +656 +0.4% +656 .rodata +0.1% +504 [ = ] 0 .strtab +0.2% +384 [ = ] 0 .symtab +0.2% +280 +0.2% +280 .eh_frame +0.2% +216 +0.2% +216 .rela.dyn +0.3% +96 +0.3% +96 .data.rel.ro +0.2% +64 +0.2% +64 .eh_frame_hdr +1.1% +16 [ = ] 0 .got.plt +0.2% +8 +0.2% +8 .rela.plt -4.6% -8 -4.6% -8 [LOAD #2 [RX]] -50.0% -48 [ = ] 0 [Unmapped] [ = ] 0 -81.7% -1.47Ki .relro_padding +0.1% +6.30Ki +0.0% +4.00Ki TOTAL ``` PiperOrigin-RevId: 579321454 |
1 year ago |
Adam Cozzette |
8defef58f4
|
Include .inc files directly instead of through a filegroup (#14575)
gRPC auto-generates CMake and other build configs from the Bazel build graph, but the logic for doing this does not know how to handle filegroups. This change works around that problem by making the `:port` target refer directly to the `.inc` files instead of going through a filegroup. This solution is not ideal but I think it's probably the best way to unblock progress for now. PiperOrigin-RevId: 578333954 |
1 year ago |
Adam Cozzette | 712badffb1 |
Include .inc files directly instead of through a filegroup
gRPC auto-generates CMake and other build configs from the Bazel build graph, but the logic for doing this does not know how to handle filegroups. This change works around that problem by making the `:port` target refer directly to the `.inc` files instead of going through a filegroup. This solution is not ideal but I think it's probably the best way to unblock progress for now. PiperOrigin-RevId: 578333954 |
1 year ago |
Adam Cozzette | 501ececd39 |
Reorganize upb file structure
This change moves almost everything in the `upb/` directory up one level, so that for example `upb/upb/generated_code_support.h` becomes just `upb/generated_code_support.h`. The only exceptions I made to this were that I left `upb/cmake` and `upb/BUILD` where they are, mostly because that avoids conflict with other files and the current locations seem reasonable for now. The `python/` directory is a little bit of a challenge because we had to merge the existing directory there with `upb/python/`. I made `upb/python/BUILD` into the BUILD file for the merged directory, and it effectively loads the contents of the other BUILD file via `python/build_targets.bzl`, but I plan to clean this up soon. PiperOrigin-RevId: 568651768 |
1 year ago |
Adam Cozzette | 0d1ba13e83 |
Move everything into new upb/ directory
|
1 year ago |
Eric Salo | 823a12e809 |
upb: restore <stdint.h> to fix 32-bit Ruby and PHP
PiperOrigin-RevId: 559494810 |
1 year ago |
Adam Cozzette | 00efe9fc1d |
Make upb compatible with `--incompatible_disallow_empty_glob`
This will allow us to run all the upb tests from the protobuf repo, which already uses this flag. I just had to remove a couple glob patterns that did not match any files. PiperOrigin-RevId: 559434154 |
1 year ago |
Eric Salo | eb9e33ec42 |
upb: remove <stddef.h> and <stdlib.h> from port/def.inc
PiperOrigin-RevId: 559234283 |
1 year ago |
Eric Salo | f4ca34807e |
upb: create upb/port/BUILD
PiperOrigin-RevId: 557506561 |
1 year ago |
Adam Cozzette | 5aca728f72 |
Reformat copyright headers
PiperOrigin-RevId: 554509301 |
1 year ago |
Jason Lunn | 1b0011dfef |
Support ASAN detection on clang (#1424)
Clang and GCC differ on how they detect Address Sanitizer. Support both. Closes #1424 COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/upb/pull/1424 from protocolbuffers:asan-clang 491a5ee4cfd24c8eb281f894de0cf4384525c46a PiperOrigin-RevId: 553805994 |
1 year ago |
Matt Kulukundis | fa1c2a6d29 |
Switch upb_Arena_Fuse from a CAS based list insertion to an exchange based one
Second try with improved testing (Generated by http://go/benchy. Settings: --runs 20 --reference "srcfs" --perflab) ``` name old cpu/op new cpu/op delta BM_ArenaOneAlloc 18.2ns ± 2% 18.1ns ± 1% -0.72% (p=0.002 n=18+17) BM_ArenaInitialBlockOneAlloc 5.31ns ± 0% 5.30ns ± 1% ~ (p=0.345 n=16+19) BM_ArenaFuseUnbalanced/2 67.8ns ± 1% 68.0ns ± 0% +0.35% (p=0.011 n=16+17) BM_ArenaFuseUnbalanced/8 526ns ± 2% 524ns ± 1% ~ (p=0.708 n=18+17) BM_ArenaFuseUnbalanced/64 4.82µs ± 1% 4.84µs ± 1% +0.31% (p=0.049 n=16+17) BM_ArenaFuseUnbalanced/128 9.78µs ± 1% 9.82µs ± 1% +0.46% (p=0.001 n=17+17) BM_ArenaFuseBalanced/2 66.9ns ± 1% 67.2ns ± 1% +0.36% (p=0.025 n=17+16) BM_ArenaFuseBalanced/8 527ns ± 2% 529ns ± 1% ~ (p=0.081 n=17+19) BM_ArenaFuseBalanced/64 4.92µs ± 4% 4.88µs ± 2% ~ (p=0.184 n=18+17) BM_ArenaFuseBalanced/128 9.92µs ± 1% 9.91µs ± 1% ~ (p=0.883 n=16+19) BM_LoadAdsDescriptor_Upb<NoLayout> 5.89ms ± 2% 5.94ms ± 1% +0.88% (p=0.005 n=18+17) BM_LoadAdsDescriptor_Upb<WithLayout> 6.55ms ± 2% 6.55ms ± 1% ~ (p=0.961 n=17+18) BM_LoadAdsDescriptor_Proto2<NoLayout> 12.3ms ± 2% 12.4ms ± 1% ~ (p=0.226 n=18+18) BM_LoadAdsDescriptor_Proto2<WithLayout> 12.5ms ± 1% 12.6ms ± 1% +0.61% (p=0.005 n=17+19) BM_Parse_Upb_FileDesc<UseArena, Copy> 12.6µs ± 1% 12.7µs ± 2% ~ (p=0.219 n=17+18) BM_Parse_Upb_FileDesc<UseArena, Alias> 11.6µs ± 2% 11.6µs ± 3% ~ (p=0.721 n=16+18) BM_Parse_Upb_FileDesc<InitBlock, Copy> 12.4µs ± 1% 12.5µs ± 1% ~ (p=0.118 n=16+17) BM_Parse_Upb_FileDesc<InitBlock, Alias> 11.3µs ± 2% 11.4µs ± 1% ~ (p=0.327 n=18+19) BM_Parse_Proto2<FileDesc, NoArena, Copy> 25.2µs ± 2% 25.3µs ± 1% ~ (p=0.301 n=16+19) BM_Parse_Proto2<FileDesc, UseArena, Copy> 12.1µs ± 3% 12.1µs ± 2% ~ (p=0.869 n=18+19) BM_Parse_Proto2<FileDesc, InitBlock, Copy> 11.8µs ± 3% 11.8µs ± 3% ~ (p=0.462 n=18+18) BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 13.2µs ± 1% 13.2µs ± 1% ~ (p=0.333 n=16+19) BM_SerializeDescriptor_Proto2 5.83µs ± 3% 5.86µs ± 4% ~ (p=0.496 n=18+20) BM_SerializeDescriptor_Upb 10.5µs ± 2% 10.4µs ± 1% -1.20% (p=0.000 n=18+16) name old time/op new time/op delta BM_ArenaOneAlloc 18.2ns ± 2% 18.1ns ± 0% -0.73% (p=0.010 n=18+17) BM_ArenaInitialBlockOneAlloc 5.32ns ± 0% 5.31ns ± 1% ~ (p=0.106 n=15+18) BM_ArenaFuseUnbalanced/2 67.9ns ± 1% 68.1ns ± 0% +0.31% (p=0.044 n=16+16) BM_ArenaFuseUnbalanced/8 527ns ± 2% 526ns ± 1% ~ (p=0.772 n=18+16) BM_ArenaFuseUnbalanced/64 4.83µs ± 1% 4.84µs ± 2% ~ (p=0.144 n=16+18) BM_ArenaFuseUnbalanced/128 9.79µs ± 1% 9.84µs ± 1% +0.52% (p=0.001 n=17+18) BM_ArenaFuseBalanced/2 67.0ns ± 1% 67.3ns ± 3% +0.41% (p=0.019 n=15+16) BM_ArenaFuseBalanced/8 528ns ± 2% 530ns ± 1% ~ (p=0.121 n=17+19) BM_ArenaFuseBalanced/64 4.93µs ± 4% 4.89µs ± 2% ~ (p=0.103 n=18+17) BM_ArenaFuseBalanced/128 9.93µs ± 1% 9.93µs ± 1% ~ (p=0.806 n=16+19) BM_LoadAdsDescriptor_Upb<NoLayout> 5.91ms ± 2% 5.96ms ± 1% +0.93% (p=0.002 n=18+16) BM_LoadAdsDescriptor_Upb<WithLayout> 6.57ms ± 2% 6.57ms ± 1% ~ (p=0.935 n=17+18) BM_LoadAdsDescriptor_Proto2<NoLayout> 12.4ms ± 2% 12.4ms ± 1% ~ (p=0.239 n=18+18) BM_LoadAdsDescriptor_Proto2<WithLayout> 12.5ms ± 2% 12.6ms ± 1% +0.43% (p=0.024 n=18+19) BM_Parse_Upb_FileDesc<UseArena, Copy> 12.7µs ± 2% 12.7µs ± 2% ~ (p=0.245 n=17+18) BM_Parse_Upb_FileDesc<UseArena, Alias> 11.6µs ± 2% 11.6µs ± 2% ~ (p=0.772 n=16+18) BM_Parse_Upb_FileDesc<InitBlock, Copy> 12.5µs ± 1% 12.5µs ± 1% ~ (p=0.136 n=16+17) BM_Parse_Upb_FileDesc<InitBlock, Alias> 11.4µs ± 2% 11.4µs ± 1% ~ (p=0.391 n=18+19) BM_Parse_Proto2<FileDesc, NoArena, Copy> 25.3µs ± 2% 25.4µs ± 1% ~ (p=0.403 n=16+19) BM_Parse_Proto2<FileDesc, UseArena, Copy> 12.1µs ± 2% 12.1µs ± 2% ~ (p=0.731 n=17+19) BM_Parse_Proto2<FileDesc, InitBlock, Copy> 11.9µs ± 3% 11.8µs ± 3% ~ (p=0.424 n=18+18) BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 13.2µs ± 2% 13.3µs ± 1% ~ (p=0.683 n=16+19) BM_SerializeDescriptor_Proto2 5.84µs ± 3% 5.86µs ± 4% ~ (p=0.496 n=18+20) BM_SerializeDescriptor_Upb 10.5µs ± 2% 10.4µs ± 1% -1.27% (p=0.000 n=18+16) name old speed new speed delta BM_LoadAdsDescriptor_Upb<NoLayout> 133MB/s ± 2% 132MB/s ± 1% -0.97% (p=0.002 n=18+16) BM_LoadAdsDescriptor_Upb<WithLayout> 120MB/s ± 2% 120MB/s ± 1% ~ (p=0.961 n=17+18) BM_LoadAdsDescriptor_Proto2<NoLayout> 63.5MB/s ± 2% 63.3MB/s ± 1% ~ (p=0.226 n=18+18) BM_LoadAdsDescriptor_Proto2<WithLayout> 62.7MB/s ± 1% 62.4MB/s ± 1% -0.60% (p=0.005 n=17+19) BM_Parse_Upb_FileDesc<UseArena, Copy> 596MB/s ± 1% 594MB/s ± 2% ~ (p=0.219 n=17+18) BM_Parse_Upb_FileDesc<UseArena, Alias> 650MB/s ± 2% 649MB/s ± 3% ~ (p=0.721 n=16+18) BM_Parse_Upb_FileDesc<InitBlock, Copy> 605MB/s ± 1% 603MB/s ± 1% ~ (p=0.118 n=16+17) BM_Parse_Upb_FileDesc<InitBlock, Alias> 663MB/s ± 2% 661MB/s ± 1% ~ (p=0.327 n=18+19) BM_Parse_Proto2<FileDesc, NoArena, Copy> 298MB/s ± 2% 297MB/s ± 1% ~ (p=0.490 n=17+19) BM_Parse_Proto2<FileDesc, UseArena, Copy> 623MB/s ± 3% 624MB/s ± 2% ~ (p=0.869 n=18+19) BM_Parse_Proto2<FileDesc, InitBlock, Copy> 636MB/s ± 3% 637MB/s ± 3% ~ (p=0.462 n=18+18) BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 570MB/s ± 1% 568MB/s ± 1% ~ (p=0.333 n=16+19) BM_SerializeDescriptor_Proto2 1.29GB/s ± 3% 1.29GB/s ± 4% ~ (p=0.496 n=18+20) BM_SerializeDescriptor_Upb 716MB/s ± 2% 725MB/s ± 1% +1.20% (p=0.000 n=18+16) ``` PiperOrigin-RevId: 525132431 |
2 years ago |
Protobuf Team Bot | 750358b863 |
Switch upb_Arena_Fuse from a CAS based list insertion to an exchange based one
``` (Generated by http://go/benchy. Settings: --runs 20 --reference "srcfs" --perflab) name old cpu/op new cpu/op delta BM_ArenaOneAlloc 18.2ns ± 2% 18.1ns ± 1% -0.72% (p=0.002 n=18+17) BM_ArenaInitialBlockOneAlloc 5.31ns ± 0% 5.30ns ± 1% ~ (p=0.345 n=16+19) BM_ArenaFuseUnbalanced/2... *** PiperOrigin-RevId: 524406384 |
2 years ago |
Matt Kulukundis | 52a8d214ca |
Switch upb_Arena_Fuse from a CAS based list insertion to an exchange based one
``` (Generated by http://go/benchy. Settings: --runs 20 --reference "srcfs" --perflab) name old cpu/op new cpu/op delta BM_ArenaOneAlloc 18.2ns ± 2% 18.1ns ± 1% -0.72% (p=0.002 n=18+17) BM_ArenaInitialBlockOneAlloc 5.31ns ± 0% 5.30ns ± 1% ~ (p=0.345 n=16+19) BM_ArenaFuseUnbalanced/2 67.8ns ± 1% 68.0ns ± 0% +0.35% (p=0.011 n=16+17) BM_ArenaFuseUnbalanced/8 526ns ± 2% 524ns ± 1% ~ (p=0.708 n=18+17) BM_ArenaFuseUnbalanced/64 4.82µs ± 1% 4.84µs ± 1% +0.31% (p=0.049 n=16+17) BM_ArenaFuseUnbalanced/128 9.78µs ± 1% 9.82µs ± 1% +0.46% (p=0.001 n=17+17) BM_ArenaFuseBalanced/2 66.9ns ± 1% 67.2ns ± 1% +0.36% (p=0.025 n=17+16) BM_ArenaFuseBalanced/8 527ns ± 2% 529ns ± 1% ~ (p=0.081 n=17+19) BM_ArenaFuseBalanced/64 4.92µs ± 4% 4.88µs ± 2% ~ (p=0.184 n=18+17) BM_ArenaFuseBalanced/128 9.92µs ± 1% 9.91µs ± 1% ~ (p=0.883 n=16+19) BM_LoadAdsDescriptor_Upb<NoLayout> 5.89ms ± 2% 5.94ms ± 1% +0.88% (p=0.005 n=18+17) BM_LoadAdsDescriptor_Upb<WithLayout> 6.55ms ± 2% 6.55ms ± 1% ~ (p=0.961 n=17+18) BM_LoadAdsDescriptor_Proto2<NoLayout> 12.3ms ± 2% 12.4ms ± 1% ~ (p=0.226 n=18+18) BM_LoadAdsDescriptor_Proto2<WithLayout> 12.5ms ± 1% 12.6ms ± 1% +0.61% (p=0.005 n=17+19) BM_Parse_Upb_FileDesc<UseArena, Copy> 12.6µs ± 1% 12.7µs ± 2% ~ (p=0.219 n=17+18) BM_Parse_Upb_FileDesc<UseArena, Alias> 11.6µs ± 2% 11.6µs ± 3% ~ (p=0.721 n=16+18) BM_Parse_Upb_FileDesc<InitBlock, Copy> 12.4µs ± 1% 12.5µs ± 1% ~ (p=0.118 n=16+17) BM_Parse_Upb_FileDesc<InitBlock, Alias> 11.3µs ± 2% 11.4µs ± 1% ~ (p=0.327 n=18+19) BM_Parse_Proto2<FileDesc, NoArena, Copy> 25.2µs ± 2% 25.3µs ± 1% ~ (p=0.301 n=16+19) BM_Parse_Proto2<FileDesc, UseArena, Copy> 12.1µs ± 3% 12.1µs ± 2% ~ (p=0.869 n=18+19) BM_Parse_Proto2<FileDesc, InitBlock, Copy> 11.8µs ± 3% 11.8µs ± 3% ~ (p=0.462 n=18+18) BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 13.2µs ± 1% 13.2µs ± 1% ~ (p=0.333 n=16+19) BM_SerializeDescriptor_Proto2 5.83µs ± 3% 5.86µs ± 4% ~ (p=0.496 n=18+20) BM_SerializeDescriptor_Upb 10.5µs ± 2% 10.4µs ± 1% -1.20% (p=0.000 n=18+16) name old time/op new time/op delta BM_ArenaOneAlloc 18.2ns ± 2% 18.1ns ± 0% -0.73% (p=0.010 n=18+17) BM_ArenaInitialBlockOneAlloc 5.32ns ± 0% 5.31ns ± 1% ~ (p=0.106 n=15+18) BM_ArenaFuseUnbalanced/2 67.9ns ± 1% 68.1ns ± 0% +0.31% (p=0.044 n=16+16) BM_ArenaFuseUnbalanced/8 527ns ± 2% 526ns ± 1% ~ (p=0.772 n=18+16) BM_ArenaFuseUnbalanced/64 4.83µs ± 1% 4.84µs ± 2% ~ (p=0.144 n=16+18) BM_ArenaFuseUnbalanced/128 9.79µs ± 1% 9.84µs ± 1% +0.52% (p=0.001 n=17+18) BM_ArenaFuseBalanced/2 67.0ns ± 1% 67.3ns ± 3% +0.41% (p=0.019 n=15+16) BM_ArenaFuseBalanced/8 528ns ± 2% 530ns ± 1% ~ (p=0.121 n=17+19) BM_ArenaFuseBalanced/64 4.93µs ± 4% 4.89µs ± 2% ~ (p=0.103 n=18+17) BM_ArenaFuseBalanced/128 9.93µs ± 1% 9.93µs ± 1% ~ (p=0.806 n=16+19) BM_LoadAdsDescriptor_Upb<NoLayout> 5.91ms ± 2% 5.96ms ± 1% +0.93% (p=0.002 n=18+16) BM_LoadAdsDescriptor_Upb<WithLayout> 6.57ms ± 2% 6.57ms ± 1% ~ (p=0.935 n=17+18) BM_LoadAdsDescriptor_Proto2<NoLayout> 12.4ms ± 2% 12.4ms ± 1% ~ (p=0.239 n=18+18) BM_LoadAdsDescriptor_Proto2<WithLayout> 12.5ms ± 2% 12.6ms ± 1% +0.43% (p=0.024 n=18+19) BM_Parse_Upb_FileDesc<UseArena, Copy> 12.7µs ± 2% 12.7µs ± 2% ~ (p=0.245 n=17+18) BM_Parse_Upb_FileDesc<UseArena, Alias> 11.6µs ± 2% 11.6µs ± 2% ~ (p=0.772 n=16+18) BM_Parse_Upb_FileDesc<InitBlock, Copy> 12.5µs ± 1% 12.5µs ± 1% ~ (p=0.136 n=16+17) BM_Parse_Upb_FileDesc<InitBlock, Alias> 11.4µs ± 2% 11.4µs ± 1% ~ (p=0.391 n=18+19) BM_Parse_Proto2<FileDesc, NoArena, Copy> 25.3µs ± 2% 25.4µs ± 1% ~ (p=0.403 n=16+19) BM_Parse_Proto2<FileDesc, UseArena, Copy> 12.1µs ± 2% 12.1µs ± 2% ~ (p=0.731 n=17+19) BM_Parse_Proto2<FileDesc, InitBlock, Copy> 11.9µs ± 3% 11.8µs ± 3% ~ (p=0.424 n=18+18) BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 13.2µs ± 2% 13.3µs ± 1% ~ (p=0.683 n=16+19) BM_SerializeDescriptor_Proto2 5.84µs ± 3% 5.86µs ± 4% ~ (p=0.496 n=18+20) BM_SerializeDescriptor_Upb 10.5µs ± 2% 10.4µs ± 1% -1.27% (p=0.000 n=18+16) name old speed new speed delta BM_LoadAdsDescriptor_Upb<NoLayout> 133MB/s ± 2% 132MB/s ± 1% -0.97% (p=0.002 n=18+16) BM_LoadAdsDescriptor_Upb<WithLayout> 120MB/s ± 2% 120MB/s ± 1% ~ (p=0.961 n=17+18) BM_LoadAdsDescriptor_Proto2<NoLayout> 63.5MB/s ± 2% 63.3MB/s ± 1% ~ (p=0.226 n=18+18) BM_LoadAdsDescriptor_Proto2<WithLayout> 62.7MB/s ± 1% 62.4MB/s ± 1% -0.60% (p=0.005 n=17+19) BM_Parse_Upb_FileDesc<UseArena, Copy> 596MB/s ± 1% 594MB/s ± 2% ~ (p=0.219 n=17+18) BM_Parse_Upb_FileDesc<UseArena, Alias> 650MB/s ± 2% 649MB/s ± 3% ~ (p=0.721 n=16+18) BM_Parse_Upb_FileDesc<InitBlock, Copy> 605MB/s ± 1% 603MB/s ± 1% ~ (p=0.118 n=16+17) BM_Parse_Upb_FileDesc<InitBlock, Alias> 663MB/s ± 2% 661MB/s ± 1% ~ (p=0.327 n=18+19) BM_Parse_Proto2<FileDesc, NoArena, Copy> 298MB/s ± 2% 297MB/s ± 1% ~ (p=0.490 n=17+19) BM_Parse_Proto2<FileDesc, UseArena, Copy> 623MB/s ± 3% 624MB/s ± 2% ~ (p=0.869 n=18+19) BM_Parse_Proto2<FileDesc, InitBlock, Copy> 636MB/s ± 3% 637MB/s ± 3% ~ (p=0.462 n=18+18) BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 570MB/s ± 1% 568MB/s ± 1% ~ (p=0.333 n=16+19) BM_SerializeDescriptor_Proto2 1.29GB/s ± 3% 1.29GB/s ± 4% ~ (p=0.496 n=18+20) BM_SerializeDescriptor_Upb 716MB/s ± 2% 725MB/s ± 1% +1.20% (p=0.000 n=18+16) ``` PiperOrigin-RevId: 524398084 |
2 years ago |
Joshua Haberman | df93cf65a2 |
Hide upb_MiniTableField.submsg_index with new `UPB_PRIVATE()` macro
The fields of upb_MiniTableField are intended to be internal-only, accessed only through public functions like `upb_MiniTable_GetSubMessageTable()`. But over time, clients have started accessing many of these fields directly. This is an easy mistake to make, as there is no clear signal that the fields should not be used in applications. This makes the implementation difficult to change without breaking users. The new `UPB_PRIVATE()` macro appends an unpredictable string to each private symbol. This makes it very difficult to accidentally use a private symbol, since users would need to write something like `field->submsg_index_dont_copy_me__upb_internal_use_only`. This is still possible to do, but it leaves a clear wart in the code showing that an an encapsulation break has occurred. The `UPB_PRIVATE()` macro itself is defined in `port/def.inc`, which users cannot include directly. Once we land this, more such CLs will follow for the other fields of `upb_MiniTable*`. We will add inline functions as needed to provide the semantic functionality needed by users. PiperOrigin-RevId: 523166901 |
2 years ago |
Joshua Haberman | 7ebeb6006b |
Fix the GitHub Actions for upb
An earlier change inadvertently disabled several GitHub Actions due to a syntax error. This broke the CI for upb because several expected tests were never running. I was not able to get the Windows CI test fully working, so I disabled it for now. PiperOrigin-RevId: 522652505 |
2 years ago |
Joshua Haberman | c642e43a5a |
Allow fuse/fuse races, so that upb_Arena is fully thread-compatible.
Previously upb_Arena was not thread-compatible when `upb_Arena_Fuse(a, b)` and `upb_Arena_Fuse(c, d)` executed in parallel if `b` and `c` were previously fused. This CL fixed that by allowing `upb_Arena_Fuse()` to run in parallel without limitations. Details on the design of the algorithm are captured in comments. The CL slightly improves the performance of `upb_Arena_Fuse()`. ``` name old cpu/op new cpu/op delta BM_ArenaOneAlloc 20.0ns ±19% 17.5ns ± 4% -12.30% (p=0.000 n=19+17) BM_ArenaInitialBlockOneAlloc 6.65ns ± 4% 5.17ns ± 3% -22.23% (p=0.000 n=18+17) BM_ArenaFuseUnbalanced/2 69.1ns ± 7% 68.5ns ± 4% ~ (p=0.327 n=18+19) BM_ArenaFuseUnbalanced/8 542ns ± 3% 513ns ± 4% -5.25% (p=0.000 n=18+18) BM_ArenaFuseUnbalanced/64 5.04µs ± 8% 4.74µs ± 4% -5.93% (p=0.000 n=17+17) BM_ArenaFuseUnbalanced/128 10.1µs ± 4% 9.6µs ± 4% -4.80% (p=0.000 n=18+17) BM_ArenaFuseBalanced/2 71.8ns ± 7% 68.4ns ± 6% -4.75% (p=0.000 n=17+17) BM_ArenaFuseBalanced/8 541ns ± 3% 519ns ± 3% -4.21% (p=0.000 n=18+17) BM_ArenaFuseBalanced/64 5.00µs ± 7% 4.86µs ± 4% -2.78% (p=0.003 n=17+18) BM_ArenaFuseBalanced/128 10.0µs ± 4% 9.7µs ± 4% -2.68% (p=0.001 n=16+18) BM_LoadAdsDescriptor_Upb<NoLayout> 5.52ms ± 2% 5.54ms ± 4% ~ (p=0.707 n=16+19) BM_LoadAdsDescriptor_Upb<WithLayout> 6.18ms ± 3% 6.15ms ± 3% ~ (p=0.501 n=18+18) BM_LoadAdsDescriptor_Proto2<NoLayout> 11.8ms ± 7% 11.7ms ± 5% ~ (p=0.330 n=16+18) BM_LoadAdsDescriptor_Proto2<WithLayout> 11.9ms ± 3% 11.8ms ± 3% ~ (p=0.303 n=18+17) BM_Parse_Upb_FileDesc<UseArena, Copy> 12.2µs ± 4% 12.3µs ± 4% ~ (p=0.935 n=17+18) BM_Parse_Upb_FileDesc<UseArena, Alias> 11.3µs ± 6% 11.3µs ± 3% ~ (p=0.873 n=16+17) BM_Parse_Upb_FileDesc<InitBlock, Copy> 12.1µs ± 4% 12.1µs ± 3% ~ (p=0.501 n=18+18) BM_Parse_Upb_FileDesc<InitBlock, Alias> 11.1µs ± 4% 11.1µs ± 2% ~ (p=0.297 n=18+16) BM_Parse_Proto2<FileDesc, NoArena, Copy> 24.2µs ± 3% 25.6µs ±16% ~ (p=0.177 n=17+20) BM_Parse_Proto2<FileDesc, UseArena, Copy> 11.6µs ± 3% 11.7µs ± 4% ~ (p=0.232 n=17+18) BM_Parse_Proto2<FileDesc, InitBlock, Copy> 11.5µs ± 7% 11.4µs ± 4% ~ (p=0.707 n=18+19) BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 12.8µs ± 5% 13.0µs ±14% ~ (p=0.782 n=18+17) BM_SerializeDescriptor_Proto2 5.69µs ± 5% 5.76µs ± 6% ~ (p=0.143 n=18+18) BM_SerializeDescriptor_Upb 10.2µs ± 4% 10.2µs ± 3% ~ (p=0.613 n=18+17) name old time/op new time/op delta BM_ArenaOneAlloc 20.0ns ±19% 17.6ns ± 4% -12.37% (p=0.000 n=19+17) BM_ArenaInitialBlockOneAlloc 6.66ns ± 4% 5.18ns ± 3% -22.24% (p=0.000 n=18+17) BM_ArenaFuseUnbalanced/2 69.2ns ± 7% 68.6ns ± 4% ~ (p=0.343 n=18+19) BM_ArenaFuseUnbalanced/8 543ns ± 3% 515ns ± 4% -5.21% (p=0.000 n=18+18) BM_ArenaFuseUnbalanced/64 5.05µs ± 8% 4.75µs ± 4% -5.93% (p=0.000 n=17+17) BM_ArenaFuseUnbalanced/128 10.1µs ± 4% 9.6µs ± 4% -4.78% (p=0.000 n=18+17) BM_ArenaFuseBalanced/2 72.0ns ± 7% 68.6ns ± 6% -4.73% (p=0.000 n=17+17) BM_ArenaFuseBalanced/8 543ns ± 3% 520ns ± 3% -4.20% (p=0.000 n=18+17) BM_ArenaFuseBalanced/64 5.01µs ± 7% 4.87µs ± 4% -2.78% (p=0.004 n=17+18) BM_ArenaFuseBalanced/128 10.0µs ± 3% 9.8µs ± 4% -2.67% (p=0.001 n=16+18) BM_LoadAdsDescriptor_Upb<NoLayout> 5.53ms ± 2% 5.56ms ± 4% ~ (p=0.707 n=16+19) BM_LoadAdsDescriptor_Upb<WithLayout> 6.20ms ± 3% 6.17ms ± 2% ~ (p=0.424 n=18+18) BM_LoadAdsDescriptor_Proto2<NoLayout> 11.8ms ± 7% 11.7ms ± 5% ~ (p=0.297 n=16+18) BM_LoadAdsDescriptor_Proto2<WithLayout> 11.9ms ± 3% 11.9ms ± 3% ~ (p=0.351 n=18+17) BM_Parse_Upb_FileDesc<UseArena, Copy> 12.3µs ± 4% 12.3µs ± 4% ~ (p=1.000 n=17+18) BM_Parse_Upb_FileDesc<UseArena, Alias> 11.3µs ± 6% 11.3µs ± 3% ~ (p=0.845 n=16+17) BM_Parse_Upb_FileDesc<InitBlock, Copy> 12.1µs ± 4% 12.1µs ± 3% ~ (p=0.542 n=18+18) BM_Parse_Upb_FileDesc<InitBlock, Alias> 11.1µs ± 4% 11.2µs ± 2% ~ (p=0.330 n=18+16) BM_Parse_Proto2<FileDesc, NoArena, Copy> 24.2µs ± 3% 25.7µs ±17% ~ (p=0.167 n=17+20) BM_Parse_Proto2<FileDesc, UseArena, Copy> 11.6µs ± 3% 11.7µs ± 3% ~ (p=0.232 n=17+18) BM_Parse_Proto2<FileDesc, InitBlock, Copy> 11.5µs ± 7% 11.4µs ± 4% ~ (p=0.799 n=18+19) BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 12.8µs ± 5% 13.0µs ±14% ~ (p=0.807 n=18+17) BM_SerializeDescriptor_Proto2 5.71µs ± 5% 5.78µs ± 6% ~ (p=0.143 n=18+18) BM_SerializeDescriptor_Upb 10.2µs ± 4% 10.2µs ± 3% ~ (p=0.613 n=18+17) name old allocs/op new allocs/op delta BM_ArenaOneAlloc 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/2 2.00 ± 0% 2.00 ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/8 8.00 ± 0% 8.00 ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/64 64.0 ± 0% 64.0 ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/128 128 ± 0% 128 ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/2 2.00 ± 0% 2.00 ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/8 8.00 ± 0% 8.00 ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/64 64.0 ± 0% 64.0 ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/128 128 ± 0% 128 ± 0% ~ (all samples are equal) BM_LoadAdsDescriptor_Upb<NoLayout> 6.05k ± 0% 6.05k ± 0% ~ (all samples are equal) BM_LoadAdsDescriptor_Upb<WithLayout> 6.36k ± 0% 6.36k ± 0% ~ (all samples are equal) BM_LoadAdsDescriptor_Proto2<NoLayout> 83.4k ± 0% 83.4k ± 0% ~ (all samples are equal) BM_LoadAdsDescriptor_Proto2<WithLayout> 84.4k ± 0% 84.4k ± 0% -0.00% (p=0.013 n=19+20) BM_Parse_Upb_FileDesc<UseArena, Copy> 7.00 ± 0% 7.00 ± 0% ~ (all samples are equal) BM_Parse_Upb_FileDesc<UseArena, Alias> 7.00 ± 0% 7.00 ± 0% ~ (all samples are equal) BM_Parse_Proto2<FileDesc, NoArena, Copy> 765 ± 0% 765 ± 0% ~ (all samples are equal) BM_Parse_Proto2<FileDesc, UseArena, Copy> 8.00 ± 0% 8.00 ± 0% ~ (all samples are equal) name old peak-mem(Bytes)/op new peak-mem(Bytes)/op delta BM_ArenaOneAlloc 336 ± 0% 328 ± 0% -2.38% (p=0.000 n=20+20) BM_ArenaFuseUnbalanced/2 672 ± 0% 656 ± 0% -2.38% (p=0.000 n=20+20) BM_ArenaFuseUnbalanced/8 2.69k ± 0% 2.62k ± 0% -2.38% (p=0.000 n=20+20) BM_ArenaFuseUnbalanced/64 21.5k ± 0% 21.0k ± 0% -2.38% (p=0.000 n=20+20) BM_ArenaFuseUnbalanced/128 43.0k ± 0% 42.0k ± 0% -2.38% (p=0.000 n=20+20) BM_ArenaFuseBalanced/2 672 ± 0% 656 ± 0% -2.38% (p=0.000 n=20+20) BM_ArenaFuseBalanced/8 2.69k ± 0% 2.62k ± 0% -2.38% (p=0.000 n=20+20) BM_ArenaFuseBalanced/64 21.5k ± 0% 21.0k ± 0% -2.38% (p=0.000 n=20+20) BM_ArenaFuseBalanced/128 43.0k ± 0% 42.0k ± 0% -2.38% (p=0.000 n=20+20) BM_LoadAdsDescriptor_Upb<NoLayout> 10.0M ± 0% 9.9M ± 0% -0.05% (p=0.000 n=20+20) BM_LoadAdsDescriptor_Upb<WithLayout> 10.0M ± 0% 10.0M ± 0% -0.05% (p=0.000 n=20+20) BM_LoadAdsDescriptor_Proto2<NoLayout> 6.62M ± 0% 6.62M ± 0% ~ (all samples are equal) BM_LoadAdsDescriptor_Proto2<WithLayout> 6.66M ± 0% 6.66M ± 0% -0.01% (p=0.013 n=19+20) BM_Parse_Upb_FileDesc<UseArena, Copy> 36.5k ± 0% 36.5k ± 0% -0.02% (p=0.000 n=20+20) BM_Parse_Upb_FileDesc<UseArena, Alias> 36.5k ± 0% 36.5k ± 0% -0.02% (p=0.000 n=20+20) BM_Parse_Proto2<FileDesc, NoArena, Copy> 35.8k ± 0% 35.8k ± 0% ~ (all samples are equal) BM_Parse_Proto2<FileDesc, UseArena, Copy> 65.3k ± 0% 65.3k ± 0% ~ (all samples are equal) name old speed new speed delta BM_LoadAdsDescriptor_Upb<NoLayout> 137MB/s ± 2% 137MB/s ± 4% ~ (p=0.707 n=16+19) BM_LoadAdsDescriptor_Upb<WithLayout> 122MB/s ± 3% 123MB/s ± 3% ~ (p=0.501 n=18+18) BM_LoadAdsDescriptor_Proto2<NoLayout> 64.2MB/s ± 7% 64.7MB/s ± 5% ~ (p=0.330 n=16+18) BM_LoadAdsDescriptor_Proto2<WithLayout> 63.6MB/s ± 3% 63.9MB/s ± 3% ~ (p=0.303 n=18+17) BM_Parse_Upb_FileDesc<UseArena, Copy> 614MB/s ± 4% 613MB/s ± 4% ~ (p=0.935 n=17+18) BM_Parse_Upb_FileDesc<UseArena, Alias> 665MB/s ± 6% 667MB/s ± 3% ~ (p=0.873 n=16+17) BM_Parse_Upb_FileDesc<InitBlock, Copy> 624MB/s ± 4% 622MB/s ± 3% ~ (p=0.501 n=18+18) BM_Parse_Upb_FileDesc<InitBlock, Alias> 681MB/s ± 4% 675MB/s ± 2% ~ (p=0.297 n=18+16) BM_Parse_Proto2<FileDesc, NoArena, Copy> 311MB/s ± 3% 296MB/s ±15% ~ (p=0.177 n=17+20) BM_Parse_Proto2<FileDesc, UseArena, Copy> 649MB/s ± 3% 644MB/s ± 3% ~ (p=0.232 n=17+18) BM_Parse_Proto2<FileDesc, InitBlock, Copy> 656MB/s ± 7% 659MB/s ± 4% ~ (p=0.707 n=18+19) BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 587MB/s ± 5% 576MB/s ±16% ~ (p=0.584 n=18+18) BM_SerializeDescriptor_Proto2 1.32GB/s ± 5% 1.31GB/s ± 7% ~ (p=0.143 n=18+18) BM_SerializeDescriptor_Upb 737MB/s ± 4% 737MB/s ± 7% ~ (p=0.839 n=18+18) ``` PiperOrigin-RevId: 520452349 |
2 years ago |
Joshua Haberman | a73852630f |
Changed Arena representation so that fusing links arenas together instead of blocks.
Previously when fusing, we would concatenate all blocks into a single list that lived in the arena root. From then on, all arenas would add their blocks to this single unified list. After this CL, arenas keep their distinct list of blocks even after being fused. Instead of unifying the block list, fuse now puts the arenas themselves into a list, so all arenas in the fused group can be iterated over at any time. This design makes it easier to keep each individual arena thread-compatible, because fuse and free are now the only mutating operations that touch state that is shared with the entire group. Read-only operations like `SpaceAllocated()` also iterate the list of arenas, but in a read-only fashion. (Note: we need tests for SpaceAllocated(), both single-threaded for correctness and multi-threaded for resilience to crashes and data races). Performance of fuse regresses by 5-20%. This is somewhat expected as we are performing more atomic operations during a fuse. ``` name old cpu/op new cpu/op delta BM_ArenaOneAlloc 18.4ns ± 6% 18.7ns ± 4% +2.00% (p=0.016 n=18+18) BM_ArenaInitialBlockOneAlloc 5.50ns ± 4% 6.57ns ± 4% +19.42% (p=0.000 n=16+17) BM_ArenaFuseUnbalanced/2 59.3ns ±10% 68.7ns ± 4% +15.85% (p=0.000 n=19+19) BM_ArenaFuseUnbalanced/8 479ns ± 5% 540ns ± 8% +12.57% (p=0.000 n=18+19) BM_ArenaFuseUnbalanced/64 4.50µs ± 4% 4.93µs ± 8% +9.59% (p=0.000 n=17+17) BM_ArenaFuseUnbalanced/128 9.24µs ± 3% 9.96µs ± 3% +7.81% (p=0.000 n=17+17) BM_ArenaFuseBalanced/2 63.3ns ±18% 71.0ns ± 4% +12.14% (p=0.000 n=19+18) BM_ArenaFuseBalanced/8 484ns ± 9% 543ns ±10% +12.11% (p=0.000 n=17+16) BM_ArenaFuseBalanced/64 4.50µs ± 6% 4.94µs ± 4% +9.62% (p=0.000 n=19+17) BM_ArenaFuseBalanced/128 9.20µs ± 4% 9.95µs ± 4% +8.12% (p=0.000 n=16+19) BM_LoadAdsDescriptor_Upb<NoLayout> 5.50ms ± 8% 5.69ms ±17% ~ (p=0.189 n=18+19) BM_LoadAdsDescriptor_Upb<WithLayout> 6.10ms ± 5% 6.05ms ± 4% ~ (p=0.258 n=17+18) BM_LoadAdsDescriptor_Proto2<NoLayout> 11.9ms ±15% 11.6ms ± 5% ~ (p=0.589 n=19+16) BM_LoadAdsDescriptor_Proto2<WithLayout> 11.8ms ± 5% 12.4ms ±17% ~ (p=0.604 n=16+20) BM_Parse_Upb_FileDesc<UseArena, Copy> 12.1µs ± 8% 12.1µs ± 4% ~ (p=1.000 n=18+18) BM_Parse_Upb_FileDesc<UseArena, Alias> 11.8µs ±17% 11.1µs ± 4% ~ (p=0.104 n=20+17) BM_Parse_Upb_FileDesc<InitBlock, Copy> 12.0µs ± 5% 11.9µs ± 4% ~ (p=0.134 n=18+19) BM_Parse_Upb_FileDesc<InitBlock, Alias> 10.9µs ± 7% 11.0µs ± 4% ~ (p=0.195 n=17+18) BM_Parse_Proto2<FileDesc, NoArena, Copy> 24.2µs ± 4% 24.4µs ± 7% ~ (p=0.767 n=18+18) BM_Parse_Proto2<FileDesc, UseArena, Copy> 11.6µs ± 5% 11.6µs ± 4% ~ (p=0.621 n=18+16) BM_Parse_Proto2<FileDesc, InitBlock, Copy> 11.3µs ± 3% 11.3µs ± 3% ~ (p=0.743 n=18+18) BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 12.7µs ± 8% 12.7µs ± 4% ~ (p=0.988 n=18+19) BM_SerializeDescriptor_Proto2 5.77µs ± 5% 5.71µs ± 5% ~ (p=0.433 n=17+17) BM_SerializeDescriptor_Upb 10.0µs ± 5% 10.1µs ± 7% ~ (p=0.102 n=19+16) name old time/op new time/op delta BM_ArenaOneAlloc 18.4ns ± 6% 18.8ns ± 4% +1.98% (p=0.019 n=18+18) BM_ArenaInitialBlockOneAlloc 5.51ns ± 4% 6.58ns ± 4% +19.42% (p=0.000 n=16+17) BM_ArenaFuseUnbalanced/2 59.5ns ±10% 68.9ns ± 4% +15.83% (p=0.000 n=19+19) BM_ArenaFuseUnbalanced/8 481ns ± 5% 541ns ± 8% +12.54% (p=0.000 n=18+19) BM_ArenaFuseUnbalanced/64 4.51µs ± 4% 4.94µs ± 8% +9.53% (p=0.000 n=17+17) BM_ArenaFuseUnbalanced/128 9.26µs ± 3% 9.98µs ± 3% +7.79% (p=0.000 n=17+17) BM_ArenaFuseBalanced/2 63.5ns ±19% 71.1ns ± 3% +12.07% (p=0.000 n=19+18) BM_ArenaFuseBalanced/8 485ns ± 9% 551ns ±20% +13.47% (p=0.000 n=17+17) BM_ArenaFuseBalanced/64 4.51µs ± 6% 4.95µs ± 4% +9.62% (p=0.000 n=19+17) BM_ArenaFuseBalanced/128 9.22µs ± 4% 9.97µs ± 4% +8.12% (p=0.000 n=16+19) BM_LoadAdsDescriptor_Upb<NoLayout> 5.52ms ± 8% 5.72ms ±18% ~ (p=0.199 n=18+19) BM_LoadAdsDescriptor_Upb<WithLayout> 6.12ms ± 5% 6.07ms ± 4% ~ (p=0.273 n=17+18) BM_LoadAdsDescriptor_Proto2<NoLayout> 11.9ms ±15% 11.6ms ± 5% ~ (p=0.589 n=19+16) BM_LoadAdsDescriptor_Proto2<WithLayout> 11.9ms ± 5% 12.5ms ±18% ~ (p=0.582 n=16+20) BM_Parse_Upb_FileDesc<UseArena, Copy> 12.2µs ± 8% 12.1µs ± 3% ~ (p=0.963 n=18+18) BM_Parse_Upb_FileDesc<UseArena, Alias> 11.8µs ±17% 11.1µs ± 4% ~ (p=0.104 n=20+17) BM_Parse_Upb_FileDesc<InitBlock, Copy> 12.0µs ± 5% 11.9µs ± 4% ~ (p=0.126 n=18+19) BM_Parse_Upb_FileDesc<InitBlock, Alias> 11.0µs ± 6% 11.1µs ± 4% ~ (p=0.195 n=17+18) BM_Parse_Proto2<FileDesc, NoArena, Copy> 24.3µs ± 4% 24.5µs ± 6% ~ (p=0.743 n=18+18) BM_Parse_Proto2<FileDesc, UseArena, Copy> 11.7µs ± 5% 11.6µs ± 4% ~ (p=0.574 n=18+16) BM_Parse_Proto2<FileDesc, InitBlock, Copy> 11.3µs ± 3% 11.3µs ± 3% ~ (p=0.743 n=18+18) BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 12.7µs ± 8% 12.7µs ± 4% ~ (p=0.988 n=18+19) BM_SerializeDescriptor_Proto2 5.78µs ± 5% 5.73µs ± 5% ~ (p=0.357 n=17+17) BM_SerializeDescriptor_Upb 10.0µs ± 5% 10.1µs ± 7% ~ (p=0.117 n=19+16) name old allocs/op new allocs/op delta BM_ArenaOneAlloc 1.00 ± 0% 1.00 ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/2 2.00 ± 0% 2.00 ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/8 8.00 ± 0% 8.00 ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/64 64.0 ± 0% 64.0 ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/128 128 ± 0% 128 ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/2 2.00 ± 0% 2.00 ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/8 8.00 ± 0% 8.00 ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/64 64.0 ± 0% 64.0 ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/128 128 ± 0% 128 ± 0% ~ (all samples are equal) BM_LoadAdsDescriptor_Upb<NoLayout> 6.08k ± 0% 6.05k ± 0% -0.54% (p=0.000 n=20+20) BM_LoadAdsDescriptor_Upb<WithLayout> 6.39k ± 0% 6.36k ± 0% -0.55% (p=0.000 n=20+20) BM_LoadAdsDescriptor_Proto2<NoLayout> 83.4k ± 0% 83.4k ± 0% ~ (p=0.800 n=20+20) BM_LoadAdsDescriptor_Proto2<WithLayout> 84.4k ± 0% 84.4k ± 0% ~ (p=0.752 n=20+20) BM_Parse_Upb_FileDesc<UseArena, Copy> 7.00 ± 0% 7.00 ± 0% ~ (all samples are equal) BM_Parse_Upb_FileDesc<UseArena, Alias> 7.00 ± 0% 7.00 ± 0% ~ (all samples are equal) BM_Parse_Proto2<FileDesc, NoArena, Copy> 765 ± 0% 765 ± 0% ~ (all samples are equal) BM_Parse_Proto2<FileDesc, UseArena, Copy> 8.00 ± 0% 8.00 ± 0% ~ (all samples are equal) name old peak-mem(Bytes)/op new peak-mem(Bytes)/op delta BM_ArenaOneAlloc 336 ± 0% 336 ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/2 672 ± 0% 672 ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/8 2.69k ± 0% 2.69k ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/64 21.5k ± 0% 21.5k ± 0% ~ (all samples are equal) BM_ArenaFuseUnbalanced/128 43.0k ± 0% 43.0k ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/2 672 ± 0% 672 ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/8 2.69k ± 0% 2.69k ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/64 21.5k ± 0% 21.5k ± 0% ~ (all samples are equal) BM_ArenaFuseBalanced/128 43.0k ± 0% 43.0k ± 0% ~ (all samples are equal) BM_LoadAdsDescriptor_Upb<NoLayout> 9.89M ± 0% 9.95M ± 0% +0.65% (p=0.000 n=20+20) BM_LoadAdsDescriptor_Upb<WithLayout> 9.95M ± 0% 10.02M ± 0% +0.70% (p=0.000 n=20+20) BM_LoadAdsDescriptor_Proto2<NoLayout> 6.62M ± 0% 6.62M ± 0% ~ (p=0.800 n=20+20) BM_LoadAdsDescriptor_Proto2<WithLayout> 6.66M ± 0% 6.66M ± 0% ~ (p=0.752 n=20+20) BM_Parse_Upb_FileDesc<UseArena, Copy> 36.5k ± 0% 36.5k ± 0% ~ (all samples are equal) BM_Parse_Upb_FileDesc<UseArena, Alias> 36.5k ± 0% 36.5k ± 0% ~ (all samples are equal) BM_Parse_Proto2<FileDesc, NoArena, Copy> 35.8k ± 0% 35.8k ± 0% ~ (all samples are equal) BM_Parse_Proto2<FileDesc, UseArena, Copy> 65.3k ± 0% 65.3k ± 0% ~ (all samples are equal) name old speed new speed delta BM_LoadAdsDescriptor_Upb<NoLayout> 138MB/s ± 7% 132MB/s ±15% ~ (p=0.126 n=18+20) BM_LoadAdsDescriptor_Upb<WithLayout> 124MB/s ± 5% 125MB/s ± 4% ~ (p=0.258 n=17+18) BM_LoadAdsDescriptor_Proto2<NoLayout> 63.9MB/s ±13% 65.2MB/s ± 5% ~ (p=0.589 n=19+16) BM_LoadAdsDescriptor_Proto2<WithLayout> 64.0MB/s ± 5% 61.3MB/s ±15% ~ (p=0.604 n=16+20) BM_Parse_Upb_FileDesc<UseArena, Copy> 620MB/s ± 8% 622MB/s ± 4% ~ (p=1.000 n=18+18) BM_Parse_Upb_FileDesc<UseArena, Alias> 644MB/s ±15% 679MB/s ± 4% ~ (p=0.104 n=20+17) BM_Parse_Upb_FileDesc<InitBlock, Copy> 627MB/s ± 4% 633MB/s ± 4% ~ (p=0.134 n=18+19) BM_Parse_Upb_FileDesc<InitBlock, Alias> 688MB/s ± 6% 682MB/s ± 4% ~ (p=0.195 n=17+18) BM_Parse_Proto2<FileDesc, NoArena, Copy> 310MB/s ± 4% 309MB/s ± 6% ~ (p=0.767 n=18+18) BM_Parse_Proto2<FileDesc, UseArena, Copy> 646MB/s ± 4% 649MB/s ± 4% ~ (p=0.621 n=18+16) BM_Parse_Proto2<FileDesc, InitBlock, Copy> 666MB/s ± 3% 666MB/s ± 3% ~ (p=0.743 n=18+18) BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 592MB/s ± 7% 593MB/s ± 4% ~ (p=0.988 n=18+19) BM_SerializeDescriptor_Proto2 1.30GB/s ± 5% 1.32GB/s ± 5% ~ (p=0.433 n=17+17) BM_SerializeDescriptor_Upb 756MB/s ± 5% 745MB/s ± 6% ~ (p=0.102 n=19+16) ``` PiperOrigin-RevId: 520144430 |
2 years ago |
Joshua Haberman | bc7795702e |
Fix the Lexan build.
PiperOrigin-RevId: 520109290 |
2 years ago |
Joshua Haberman | 9c0bcc0e90 |
Revamped portable atomic layer
Two main improvements: 1. Memory order is an explicit parameter. 2. Functions are type-generic. PiperOrigin-RevId: 520074974 |
2 years ago |
Joshua Haberman | d450990631 |
Allow for fuse/free races in `upb_Arena`.
Implementation is by kfm@, I only added the portability code around it. `upb_Arena` was designed to be only thread-compatible. However, fusing of arenas muddies the waters somewhat, because two distinct `upb_Arena` objects will end up sharing state when fused. This causes a `upb_Arena_Free(a)` to interfere with `upb_Arena_Fuse(b, c)` if `a` and `b` were previously fused. It turns out that we can use atomics to fix this with about a 35% regression in fuse performance (see below). Arena create+free does not regress, thanks to special-case logic in Free(). `upb_Arena` is still a thread-compatible type, and it is still never safe to call `upb_Arena_xxx(a)` and `upb_Arena_yyy(a)` in parallel. However you can at least now call `upb_Arena_Free(a)` and `upb_Arena_Fuse(b, c)` in parallel, even if `a` and `b` were previously fused. Note that `upb_Arena_Fuse(a, b)` and `upb_Arena_Fuse(c, d)` is still not allowed if `b` and `c` were previously fused. In practice this means that fuses must still be single-threaded within a single fused group. Performance results: ``` name old cpu/op new cpu/op delta BM_ArenaOneAlloc 18.6ns ± 1% 18.6ns ± 1% ~ (p=0.726 n=18+17) BM_ArenaInitialBlockOneAlloc 6.28ns ± 1% 5.73ns ± 1% -8.68% (p=0.000 n=17+20) BM_ArenaFuseUnbalanced/2 44.1ns ± 2% 60.4ns ± 1% +37.05% (p=0.000 n=18+19) BM_ArenaFuseUnbalanced/8 370ns ± 2% 500ns ± 1% +35.12% (p=0.000 n=19+20) BM_ArenaFuseUnbalanced/64 3.52µs ± 1% 4.71µs ± 1% +33.80% (p=0.000 n=18+19) BM_ArenaFuseUnbalanced/128 7.20µs ± 1% 9.72µs ± 2% +34.93% (p=0.000 n=16+19) BM_ArenaFuseBalanced/2 44.4ns ± 2% 61.4ns ± 1% +38.23% (p=0.000 n=20+17) BM_ArenaFuseBalanced/8 373ns ± 2% 509ns ± 1% +36.57% (p=0.000 n=19+17) BM_ArenaFuseBalanced/64 3.55µs ± 2% 4.79µs ± 1% +34.80% (p=0.000 n=19+19) BM_ArenaFuseBalanced/128 7.26µs ± 1% 9.76µs ± 1% +34.45% (p=0.000 n=17+19) BM_LoadAdsDescriptor_Upb<NoLayout> 5.66ms ± 1% 5.69ms ± 1% +0.57% (p=0.013 n=18+20) BM_LoadAdsDescriptor_Upb<WithLayout> 6.30ms ± 1% 6.36ms ± 1% +0.90% (p=0.000 n=19+18) BM_LoadAdsDescriptor_Proto2<NoLayout> 12.1ms ± 1% 12.1ms ± 1% ~ (p=0.118 n=18+18) BM_LoadAdsDescriptor_Proto2<WithLayout> 12.2ms ± 1% 12.3ms ± 1% +0.50% (p=0.006 n=18+18) BM_Parse_Upb_FileDesc<UseArena, Copy> 12.7µs ± 1% 12.7µs ± 1% ~ (p=0.194 n=20+19) BM_Parse_Upb_FileDesc<UseArena, Alias> 11.6µs ± 1% 11.6µs ± 1% ~ (p=0.192 n=20+20) BM_Parse_Upb_FileDesc<InitBlock, Copy> 12.5µs ± 1% 12.5µs ± 0% ~ (p=0.750 n=18+14) BM_Parse_Upb_FileDesc<InitBlock, Alias> 11.4µs ± 1% 11.3µs ± 1% -0.34% (p=0.046 n=19+19) BM_Parse_Proto2<FileDesc, NoArena, Copy> 25.4µs ± 1% 25.7µs ± 2% +1.37% (p=0.000 n=18+18) BM_Parse_Proto2<FileDesc, UseArena, Copy> 12.1µs ± 2% 12.1µs ± 1% ~ (p=0.143 n=18+18) BM_Parse_Proto2<FileDesc, InitBlock, Copy> 11.9µs ± 3% 11.9µs ± 1% ~ (p=0.076 n=17+19) BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 13.2µs ± 1% 13.2µs ± 1% ~ (p=0.053 n=19+19) BM_SerializeDescriptor_Proto2 5.97µs ± 4% 5.90µs ± 4% ~ (p=0.093 n=17+19) BM_SerializeDescriptor_Upb 10.4µs ± 1% 10.4µs ± 1% ~ (p=0.909 n=17+18) name old time/op new time/op delta BM_ArenaOneAlloc 18.7ns ± 2% 18.6ns ± 0% ~ (p=0.607 n=18+17) BM_ArenaInitialBlockOneAlloc 6.29ns ± 1% 5.74ns ± 1% -8.71% (p=0.000 n=17+19) BM_ArenaFuseUnbalanced/2 44.1ns ± 1% 60.6ns ± 1% +37.21% (p=0.000 n=17+19) BM_ArenaFuseUnbalanced/8 371ns ± 2% 500ns ± 1% +35.02% (p=0.000 n=19+16) BM_ArenaFuseUnbalanced/64 3.53µs ± 1% 4.72µs ± 1% +33.85% (p=0.000 n=18+19) BM_ArenaFuseUnbalanced/128 7.22µs ± 1% 9.73µs ± 2% +34.87% (p=0.000 n=16+19) BM_ArenaFuseBalanced/2 44.5ns ± 2% 61.5ns ± 1% +38.22% (p=0.000 n=20+17) BM_ArenaFuseBalanced/8 373ns ± 2% 510ns ± 1% +36.58% (p=0.000 n=19+16) BM_ArenaFuseBalanced/64 3.56µs ± 2% 4.80µs ± 1% +34.87% (p=0.000 n=19+19) BM_ArenaFuseBalanced/128 7.27µs ± 1% 9.77µs ± 1% +34.40% (p=0.000 n=17+19) BM_LoadAdsDescriptor_Upb<NoLayout> 5.67ms ± 1% 5.71ms ± 1% +0.60% (p=0.011 n=18+20) BM_LoadAdsDescriptor_Upb<WithLayout> 6.32ms ± 1% 6.37ms ± 1% +0.87% (p=0.000 n=19+18) BM_LoadAdsDescriptor_Proto2<NoLayout> 12.1ms ± 1% 12.2ms ± 1% ~ (p=0.126 n=18+19) BM_LoadAdsDescriptor_Proto2<WithLayout> 12.2ms ± 1% 12.3ms ± 1% +0.51% (p=0.002 n=18+18) BM_Parse_Upb_FileDesc<UseArena, Copy> 12.7µs ± 1% 12.7µs ± 1% ~ (p=0.149 n=20+19) BM_Parse_Upb_FileDesc<UseArena, Alias> 11.6µs ± 1% 11.6µs ± 1% ~ (p=0.211 n=20+20) BM_Parse_Upb_FileDesc<InitBlock, Copy> 12.5µs ± 1% 12.5µs ± 1% ~ (p=0.986 n=18+15) BM_Parse_Upb_FileDesc<InitBlock, Alias> 11.4µs ± 1% 11.3µs ± 1% ~ (p=0.081 n=19+18) BM_Parse_Proto2<FileDesc, NoArena, Copy> 25.4µs ± 1% 25.8µs ± 2% +1.41% (p=0.000 n=18+18) BM_Parse_Proto2<FileDesc, UseArena, Copy> 12.1µs ± 2% 12.1µs ± 1% ~ (p=0.558 n=19+18) BM_Parse_Proto2<FileDesc, InitBlock, Copy> 12.0µs ± 3% 11.9µs ± 1% ~ (p=0.165 n=17+19) BM_Parse_Proto2<FileDescSV, InitBlock, Alias> 13.2µs ± 1% 13.2µs ± 1% ~ (p=0.070 n=19+19) BM_SerializeDescriptor_Proto2 5.98µs ± 4% 5.92µs ± 3% ~ (p=0.138 n=17+19) BM_SerializeDescriptor_Upb 10.4µs ± 1% 10.4µs ± 1% ~ (p=0.858 n=17+18) ``` PiperOrigin-RevId: 518573683 |
2 years ago |
Dmitri Gribenko | 21af7830ad |
Use _Alignof in UPB_ALIGN_OF instead of an offsetof trick
The offsetof trick is not compatible with an incoming Clang change.
Clang has started to enforce that it is UB to declare types inside offsetof. See
|
2 years ago |
Joshua Haberman | e41a2d7ba0 |
upb is self-hosting!
This CL changes the upb compiler to no longer depend on C++ protobuf libraries. upb now uses its own reflection libraries to implement its code generator. # Key Benefits 1. upb can now use its own reflection libraries throughout the compiler. This makes upb more consistent and principled, and gives us more chances to dogfood our own C++ reflection API. This highlighted several parts of the C++ reflection API that were incomplete. 2. This CL removes code duplication that previously existed in the compiler. The upb reflection library has code to build MiniDescriptors and MiniTables out of descriptors, but prior to this CL the upb compiler could not use it. The upb compiler had a separate copy of this logic, and the compiler's copy of this logic was especially tricky and hard to maintain. This CL removes the separate copy of that logic. 3. This CL (mostly) removes upb's dependency on the C++ protobuf library. We still depend on `protoc` (the binary), but the runtime and compiler no longer link against C++'s libraries. This opens up the possibility of speeding up some builds significantly if we can use a prebuilt `protoc` binary. # Bootstrap Stages To bootstrap, we check in a copy of our generated code for `descriptor.proto` and `plugin.proto`. This allows the compiler to depend on the generated code for these two protos without creating a circular dependency. This code is checked in to the `stage0` directory. The bootstrapping process is divided into a few stages. All `cc_library()`, `upb_proto_library()`, and `cc_binary()` targets that would otherwise be circular participate in this staging process. That currently includes: * `//third_party/upb:descriptor_upb_proto` * `//third_party/upb:plugin_upb_proto` * `//third_party/upb:reflection` * `//third_party/upb:reflection_internal` * `//third_party/upbc:common` * `//third_party/upbc:file_layout` * `//third_party/upbc:plugin` * `//third_party/upbc:protoc-gen-upb` For each of these targets, we produce a rule for each stage (the logic for this is nicely encapsulated in Blaze/Bazel macros like `bootstrap_cc_library()` and `bootstrap_upb_proto_library()`, so the `BUILD` file remains readable). For example: * `//third_party/upb:descriptor_upb_proto_stage0` * `//third_party/upb:descriptor_upb_proto_stage1` * `//third_party/upb:descriptor_upb_proto` The stages are: 1. `stage0`: This uses the checked-in version of the generated code. The stage0 compiler is correct and outputs the same code as all other compilers, but it is unnecessarily slow because its protos were compiled in bootstrap mode. The stage0 compiler is used to generate protos for stage1. 2. `stage1`: The stage1 compiler is correct and fast, and therefore we use it in almost all cases (eg. `upb_proto_library()`). However its own protos were not generated using `upb_proto_library()`, so its `cc_library()` targets cannot be safely mixed with `upb_proto_library()`, as this would lead to duplicate symbols. 3. final (no stage): The final compiler is identical to the `stage1` compiler. The only difference is that its protos were built with `upb_proto_library()`. This doesn't matter very much for the compiler binary, but for the `cc_library()` targets like `//third_party/upb:reflection`, only the final targets can be safely linked in by other applications. # "Bootstrap Mode" Protos The checked-in generated code is generated in a special "bootstrap" mode that is a bit different than normal generated code. Bootstrap mode avoids depending on the internal representation of MiniTables or the messages, at the cost of slower runtime performance. Bootstrap mode only interacts with MiniTables and messages using public APIs such as `upb_MiniTable_Build()`, `upb_Message_GetInt32()`, etc. This is very important as it allows us to change the internal representation without needing to regenerate our bootstrap protos. This will make it far easier to write CLs that change the internal representation, because it avoids the awkward dance of trying to regenerate the bootstrap protos when the compiler itself is broken due to bootstrap protos being out of date. The bootstrap generated code does have two downsides: 1. The accessors are less efficient, because they look up MiniTable fields by number instead of hard-coding the MiniTableField into the generated code. 2. It requires runtime initialization of the MiniTables, which costs CPU cycles at startup, and also allocates memory which is never freed. Per google3 rules this is not really a leak, since this memory is still reachable via static variables, but it is undesirable in many contexts. We could fix this part by introducing the equivalent of `google::protobuf::ShutdownProtobufLibrary()`). These downsides are fine for the bootstrapping process, but they are reason enough not to enable bootstrap mode in general for all protos. # Bootstrapping Always Uses OSS Protos To enable smooth syncing between Google3 and OSS, we always use an OSS version of the checked in generated code for `stage0`, even in google3. This requires that the google3 code can be switched to reference the OSS proto names using a preprocessor define. We introduce the `UPB_DESC(xyz)` macro for this, which will expand into either `proto2_xyz` or `google_protobuf_xyz`. Any libraries used in `stage0` must use `UPB_DESC(xyz)` rather than refer to the symbol names directly. PiperOrigin-RevId: 501458451 |
2 years ago |
Joshua Haberman | 204b9eeffa |
Added UPB_DESC() macro for all bootstrap references to proto symbols.
We have previously been using Copybara to rewrite these names, but for bootstrapping we will want to be able to sometimes use OSS names inside google3. PiperOrigin-RevId: 500294974 |
2 years ago |
Joshua Haberman | 143132fa27 |
Make upb's generated code agnostic to fasttable.
This simplifies the code generation by making output agnostic to whether fasttables will be used or not. This grows the generated code in the common case, but when fasttables are not being used the preprocessor will strip away the unused tables. PiperOrigin-RevId: 499340805 |
2 years ago |
Joshua Haberman | fa2481ddeb |
Unified accessor for WhichOneof().
PiperOrigin-RevId: 495220998 |
2 years ago |
Protobuf Team Bot | 79abc9f1a1 |
Implement UPB_UNREACHABLE for Visual C++.
See https://stackoverflow.com/a/60802890. PiperOrigin-RevId: 493726837 |
2 years ago |
Eric Salo | ae24d717b0 |
create initial dart ffigen hooks
PiperOrigin-RevId: 492528444 |
2 years ago |
Joshua Haberman | d22d6d71ed |
Refactored message accessors to share a common set of functions instead of duplicating logic.
Prior to this CL, there were several different code paths for reading/writing message data. Generated code, MiniTable accessors, and reflection all performed direct manipulation of the bits and bytes in a message, but they all had distinct implementations that did not share much of any code. This divergence meant that they could easily have different behavior, bugs could creep into one but not another, and we would need three different sets of tests to get full test coverage. This also made it very difficult to change the internal representation in any way, since it would require updating many places in the code. With this CL, the three different APIs for accessing message data now all share a common set of functions. The common functions all take a `upb_MiniTableField` as the canonical description of a field's type and layout. The lowest-level functions are very branchy, as they must test for every possible variation in the field type (field vs oneof, hasbit vs no-hasbit, different field sizes, whether a nonzero default value exists, extension vs. regular field), however these functions are declared inline and designed to be very optimizable when values are known at compile time. In generated accessors, for example, we can declare constant `upb_MiniTableField` instances so that all values can constant-propagate, and we can get fully specialized code even though we are calling a generic function. On the other hand, when we use the generic functions from reflection, we get runtime branches since values are not known at compile time. But even the function is written to still be as efficient as possible even when used from reflection. For example, we use memcpy() calls with constant length so that the compiler can optimize these into inline loads/stores without having to make an out-of-line call to memcpy(). In this way, this CL should be a benefit to both correctness and performance. It will also make it easier to change the message representation, for example to optimize the encoder by giving hasbits to all fields. Note that we have not completely consolidated all access in this CL: 1. Some functions outside of get/set such as clear and hazzers are not yet unified. 2. The encoder and decoder still touch the message without going through the common functions. The encoder and decoder require a bit more specialized code to get good performance when reading/writing fields en masse. PiperOrigin-RevId: 490016095 |
2 years ago |
Eric Salo | 9582dc2058 |
fix UPB_LIKELY() for 32-bit Windows builds and update to latest protobuf commit
https://github.com/protocolbuffers/protobuf/issues/10950 PiperOrigin-RevId: 489095346 |
2 years ago |
Eric Salo | f6307877d3 |
move portability stuff into upb/port/
Also delete redundant system #includes that are already pulled in by port/def.inc PiperOrigin-RevId: 486398989 |
2 years ago |