More google3 fixes.

pull/13171/head
Joshua Haberman 4 years ago
parent d2446fd2db
commit da48e01f05
  1. 9
      benchmarks/BUILD
  2. 6
      benchmarks/build_defs.bzl
  3. 8
      benchmarks/gen_synthetic_protos.py

@ -80,6 +80,7 @@ SIZE_BENCHMARKS = {
py_binary(
name = "gen_synthetic_protos",
srcs = ["gen_synthetic_protos.py"],
python_version = "PY3",
)
py_binary(
@ -103,7 +104,7 @@ genrule(
"100_fields.proto",
"200_fields.proto",
],
cmd = "$(execpath :gen_synthetic_protos) $(GENDIR)",
cmd = "$(execpath :gen_synthetic_protos) $(RULEDIR)",
)
proto_library(
@ -145,7 +146,7 @@ tmpl_cc_binary(
testonly = 1,
gen = ":gen_upb_binary_c",
args = [
"benchmarks/" + k + ".upb.h",
package_name() + "/" + k + ".upb.h",
"upb_benchmark_" + v,
],
deps = [
@ -157,7 +158,7 @@ tmpl_cc_binary(
testonly = 1,
gen = ":gen_protobuf_binary_cc",
args = [
"benchmarks/" + k + ".pb.h",
package_name() + "/" + k + ".pb.h",
"upb_benchmark::" + v,
],
deps = [
@ -174,7 +175,7 @@ tmpl_cc_binary(
testonly = 1,
gen = ":gen_protobuf_binary_cc",
args = [
"benchmarks/" + k + "_lite.pb.h",
package_name() + "/" + k + "_lite.pb.h",
"upb_benchmark::" + v,
],
deps = [

@ -25,6 +25,10 @@ def tmpl_cc_binary(name, gen, args, replacements = [], **kwargs):
)
native.cc_binary(
# copybara:insert_for_google3_begin
# malloc="//base:system_malloc",
# features = ["-static_linking_mode"],
# copybara:insert_end
name = name,
srcs = srcs,
**kwargs,
@ -41,7 +45,7 @@ def cc_lite_proto_library(name, srcs, outs):
cmd = "cp $< $@ && chmod a+w $@ && echo 'option optimize_for = LITE_RUNTIME;' >> $@",
)
native.proto_library(
proto_library(
name = name + "_proto",
srcs = outs,
)

@ -51,21 +51,21 @@ def choices(k):
print("WARNING: old Python version, field types are not properly weighted!")
return [random.choice(population) for _ in range(k)]
with open(base + "/benchmarks/100_msgs.proto", "w") as f:
with open(base + "/100_msgs.proto", "w") as f:
f.write('syntax = "proto3";\n')
f.write('package upb_benchmark;\n')
f.write('message Message {}\n')
for i in range(2, 101):
f.write('message Message{i} {{}}\n'.format(i=i))
with open(base + "/benchmarks/200_msgs.proto", "w") as f:
with open(base + "/200_msgs.proto", "w") as f:
f.write('syntax = "proto3";\n')
f.write('package upb_benchmark;\n')
f.write('message Message {}\n')
for i in range(2, 501):
f.write('message Message{i} {{}}\n'.format(i=i))
with open(base + "/benchmarks/100_fields.proto", "w") as f:
with open(base + "/100_fields.proto", "w") as f:
f.write('syntax = "proto2";\n')
f.write('package upb_benchmark;\n')
f.write('enum Enum { ZERO = 0; }\n')
@ -78,7 +78,7 @@ with open(base + "/benchmarks/100_fields.proto", "w") as f:
i += 1
f.write('}\n')
with open(base + "/benchmarks/200_fields.proto", "w") as f:
with open(base + "/200_fields.proto", "w") as f:
f.write('syntax = "proto2";\n')
f.write('package upb_benchmark;\n')
f.write('enum Enum { ZERO = 0; }\n')

Loading…
Cancel
Save