commit | d520014cfa0872db348f7b535652a971b9c07a47 | [log] [tgz] |
---|---|---|
author | Joshua Haberman <haberman@google.com> | Tue Mar 21 09:16:12 2023 -0700 |
committer | Copybara-Service <copybara-worker@google.com> | Tue Mar 21 09:16:52 2023 -0700 |
tree | f9092eebb3609acea87285d4f4c39d6f9847c005 | |
parent | 666a28e6ac7361d8a14def7ab1253a8406fbac3e [diff] |
Added benchmarks for `upb_Arena_Fuse()` I added two variants, one which is unbalanced (always fusing a single arena into the group) while the other is balanced (always fusing two groups of equal size). Unfortunately it is difficult to benchmark `upb_Arena_Free()` separately from fuse, since the only way to get a non-zero refcount is to fuse. Results on my machine: ``` CPU: Intel Skylake Xeon with HyperThreading (48 cores) dL1:32KB dL2:1024KB dL3:38MB Benchmark Time(ns) CPU(ns) Iterations ------------------------------------------------------------------- BM_ArenaFuseUnbalanced/2 52.2 52.2 1000000 38.300M items/s BM_ArenaFuseUnbalanced/8 416 416 142315 19.243M items/s BM_ArenaFuseUnbalanced/64 4034 4033 14306 15.868M items/s BM_ArenaFuseUnbalanced/128 8302 8301 6837 15.420M items/s BM_ArenaFuseBalanced/2 54.7 54.7 1000000 36.581M items/s BM_ArenaFuseBalanced/8 425 425 100000 18.845M items/s BM_ArenaFuseBalanced/64 4029 4029 14632 15.886M items/s BM_ArenaFuseBalanced/128 8050 8049 7176 15.902M items/s ``` PiperOrigin-RevId: 518292073
μpb (often written ‘upb’) is a small protobuf implementation written in C.
upb is the core runtime for protobuf languages extensions in Ruby, PHP, and Python.
While upb offers a C API, the C API & ABI are not stable. For this reason, upb is not generally offered as a C library for direct consumption, and there are no releases.
upb has comparable speed to protobuf C++, but is an order of magnitude smaller in code size.
Like the main protobuf implementation in C++, it supports:
upb also supports some features that C++ does not:
However there are a few features it does not support:
protoc
.For Ruby, use RubyGems:
$ gem install google-protobuf
For PHP, use PECL:
$ sudo pecl install protobuf
For Python, use PyPI:
$ sudo pip install protobuf
Alternatively, you can build and install upb using vcpkg dependency manager:
git clone https://github.com/Microsoft/vcpkg.git cd vcpkg ./bootstrap-vcpkg.sh ./vcpkg integrate install ./vcpkg install upb
The upb port in vcpkg is kept up to date by microsoft team members and community contributors.
If the version is out of date, please create an issue or pull request on the vcpkg repository.
Please see CONTRIBUTING.md.