parent
a7e2e8338d
commit
8a3470c543
4 changed files with 89 additions and 0 deletions
@ -0,0 +1,10 @@ |
|||||||
|
|
||||||
|
#include "google/protobuf/empty.pb.h" |
||||||
|
|
||||||
|
char buf[1]; |
||||||
|
|
||||||
|
int main() { |
||||||
|
google::protobuf::Empty proto; |
||||||
|
proto.ParseFromArray(buf, 1); |
||||||
|
proto.SerializeToArray(buf, 1); |
||||||
|
} |
@ -0,0 +1,35 @@ |
|||||||
|
// A small proto, for measuring the overhead of a minimal use of |
||||||
|
// protocol buffers. |
||||||
|
|
||||||
|
syntax = "proto3"; |
||||||
|
|
||||||
|
option optimize_for = LITE_RUNTIME; |
||||||
|
option cc_enable_arenas = true; |
||||||
|
|
||||||
|
package upb_benchmark; |
||||||
|
|
||||||
|
message Person { |
||||||
|
string name = 1; |
||||||
|
int32 id = 2; // Unique ID number for this person. |
||||||
|
string email = 3; |
||||||
|
|
||||||
|
enum PhoneType { |
||||||
|
MOBILE = 0; |
||||||
|
HOME = 1; |
||||||
|
WORK = 2; |
||||||
|
} |
||||||
|
|
||||||
|
message PhoneNumber { |
||||||
|
string number = 1; |
||||||
|
PhoneType type = 2; |
||||||
|
} |
||||||
|
|
||||||
|
repeated PhoneNumber phones = 4; |
||||||
|
|
||||||
|
int64 last_updated = 5; |
||||||
|
} |
||||||
|
|
||||||
|
// Our address book file is just one of these. |
||||||
|
message AddressBook { |
||||||
|
repeated Person people = 1; |
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
|
||||||
|
#include "google/protobuf/empty.upb.h" |
||||||
|
|
||||||
|
char buf[1]; |
||||||
|
|
||||||
|
int main() { |
||||||
|
upb_arena *arena = upb_arena_new(); |
||||||
|
size_t size; |
||||||
|
google_protobuf_Empty *proto = google_protobuf_Empty_parse(buf, 1, arena); |
||||||
|
google_protobuf_Empty_serialize(proto, arena, &size); |
||||||
|
return 0; |
||||||
|
} |
Loading…
Reference in new issue