Debian Codegraph @

third_party/upb/README.md

raw
1
2 # μpb: small, fast C protos
3
4 μpb (often written 'upb') is a small
5 [protobuf](https://github.com/protocolbuffers/protobuf) implementation written
6 in C.
7
8 upb is the core runtime for protobuf languages extensions in
9 [Ruby](https://github.com/protocolbuffers/protobuf/tree/master/ruby),
10 [PHP](https://github.com/protocolbuffers/protobuf/tree/master/php), and (soon)
11 Python.
12
13 While upb offers a C API, the C API & ABI **are not stable**. For this reason,
14 upb is not generally offered as a C library for direct consumption, and there
15 are no releases.
16
17 ## Features
18
19 upb has comparable speed to protobuf C++, but is an order of magnitude smaller
20 in code size.
21
22 Like the main protobuf implementation in C++, it supports:
23
24 - a generated API (in C)
25 - reflection
26 - binary & JSON wire formats
27 - text format serialization
28 - all standard features of protobufs (oneofs, maps, unknown fields, extensions,
29 etc.)
30 - full conformance with the protobuf conformance tests
31
32 upb also supports some features that C++ does not:
33
34 - **optional reflection:** generated messages are agnostic to whether
35 reflection will be linked in or not.
36 - **no global state:** no pre-main registration or other global state.
37 - **fast reflection-based parsing:** messages loaded at runtime parse
38 just as fast as compiled-in messages.
39
40 However there are a few features it does not support:
41
42 - text format parsing
43 - deep descriptor verification: upb's descriptor validation is not as exhaustive
44 as `protoc`.
45
46 ## Install
47
48 For Ruby, use [RubyGems](https://rubygems.org/gems/google-protobuf):
49
50 ```
51 $ gem install google-protobuf
52 ```
53
54 For PHP, use [PECL](https://pecl.php.net/package/protobuf):
55
56 ```
57 $ sudo pecl install protobuf
58 ```
59
60 Alternatively, you can build and install upb using
61 [vcpkg](https://github.com/microsoft/vcpkg/) dependency manager:
62
63 git clone https://github.com/Microsoft/vcpkg.git
64 cd vcpkg
65 ./bootstrap-vcpkg.sh
66 ./vcpkg integrate install
67 ./vcpkg install upb
68
69 The upb port in vcpkg is kept up to date by microsoft team members and community
70 contributors.
71
72 If the version is out of date, please
73 [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the
74 vcpkg repository.
75
76 ## Contributing
77
78 Please see [CONTRIBUTING.md](CONTRIBUTING.md).