Skip to content

Commit e479410

Browse files
daixiang0BSBandme
authored andcommitted
delete all duplicate empty blanks (protocolbuffers#5758)
Signed-off-by: Xiang Dai <[email protected]>
1 parent c691c4c commit e479410

File tree

141 files changed

+984
-984
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+984
-984
lines changed

benchmarks/Makefile.am

+16-16
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ java_benchmark_testing_files = \
126126
java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java
127127

128128
javac_middleman: $(java_benchmark_testing_files) protoc_middleman protoc_middleman2
129-
cp -r $(srcdir)/java tmp
129+
cp -r $(srcdir)/java tmp
130130
mkdir -p tmp/java/lib
131131
cp $(top_srcdir)/java/core/target/*.jar tmp/java/lib/protobuf-java.jar
132132
cd tmp/java && mvn clean compile assembly:single -Dprotobuf.version=$(PACKAGE_VERSION) && cd ../..
@@ -253,7 +253,7 @@ go_protoc_middleman: make_tmp_dir $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks
253253
oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2_message4) )
254254
touch go_protoc_middleman
255255

256-
go-benchmark: go_protoc_middleman
256+
go-benchmark: go_protoc_middleman
257257
@echo "Writing shortcut script go-benchmark..."
258258
@echo '#! /bin/bash' > go-benchmark
259259
@echo 'cd $(srcdir)/go' >> go-benchmark
@@ -265,7 +265,7 @@ go-benchmark: go_protoc_middleman
265265
@echo 'cd ..' >> go-benchmark
266266
@chmod +x go-benchmark
267267

268-
go: go_protoc_middleman go-benchmark
268+
go: go_protoc_middleman go-benchmark
269269
./go-benchmark $(all_data)
270270

271271
############# GO RULES END ##############
@@ -322,9 +322,9 @@ $(cpp_no_group_benchmarks_protoc_outputs_proto2_header): cpp_no_group_protoc_mid
322322
generate_cpp_no_group_benchmark_code:
323323
cp $(srcdir)/cpp/cpp_benchmark.cc gogo/cpp_no_group/cpp_benchmark.cc
324324
sed -i -e "s/\#include \"datasets/\#include \"gogo\/cpp_no_group\/datasets/g" gogo/cpp_no_group/cpp_benchmark.cc
325-
sed -i -e "s/\#include \"benchmarks.pb.h/\#include \"gogo\/cpp_no_group\/benchmarks.pb.h/g" gogo/cpp_no_group/cpp_benchmark.cc
325+
sed -i -e "s/\#include \"benchmarks.pb.h/\#include \"gogo\/cpp_no_group\/benchmarks.pb.h/g" gogo/cpp_no_group/cpp_benchmark.cc
326326
touch generate_cpp_no_group_benchmark_code
327-
327+
328328
bin_PROGRAMS += cpp-no-group-benchmark
329329
cpp_no_group_benchmark_LDADD = $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a
330330
cpp_no_group_benchmark_SOURCES = gogo/cpp_no_group/cpp_benchmark.cc
@@ -343,7 +343,7 @@ nodist_cpp_no_group_benchmark_SOURCES = \
343343

344344
cpp_no_group: cpp_no_group_protoc_middleman generate_gogo_data cpp-no-group-benchmark
345345
./cpp-no-group-benchmark $(gogo_data)
346-
346+
347347
gogo_proto_middleman: protoc-gen-gogoproto
348348
mkdir -p "tmp/gogo_proto"
349349
oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I$(srcdir) -I$(top_srcdir) --plugin=protoc-gen-gogoproto --gogoproto_out=$$oldpwd/tmp/gogo_proto $(benchmarks_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) $(benchmarks_protoc_inputs_proto2) )
@@ -355,7 +355,7 @@ generate_gogo_data: protoc_middleman protoc_middleman2 gogo-data-scrubber
355355
mkdir -p `dirname $(gogo_data)`
356356
./gogo-data-scrubber $(all_data) $(gogo_data)
357357
touch generate_gogo_data
358-
358+
359359
make_tmp_dir_gogo:
360360
mkdir -p tmp/go_no_group/benchmark_code
361361
mkdir -p tmp/gogofast/benchmark_code
@@ -435,10 +435,10 @@ gogo-benchmark:
435435

436436
go_no_group: go_no_group_protoc_middleman generate_gogo_data generate_all_gogo_benchmark_code gogo-benchmark
437437
./gogo-benchmark go_no_group $(gogo_data)
438-
439-
gogofast: gogofast_protoc_middleman generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code
438+
439+
gogofast: gogofast_protoc_middleman generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code
440440
./gogo-benchmark gogofast $(gogo_data)
441-
441+
442442
gogofaster: gogofaster_protoc_middleman generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code
443443
./gogo-benchmark gogofaster $(gogo_data)
444444

@@ -448,7 +448,7 @@ gogoslick: gogoslick_protoc_middleman generate_gogo_data gogo-benchmark generat
448448

449449
############# GOGO RULES END ############
450450

451-
451+
452452
############ UTIL RULES BEGIN ############
453453

454454
bin_PROGRAMS += protoc-gen-gogoproto gogo-data-scrubber protoc-gen-proto2_to_proto3 proto3-data-stripper
@@ -481,7 +481,7 @@ nodist_proto3_data_stripper_SOURCES = \
481481
$(benchmarks_protoc_outputs_proto2_header) \
482482
$(benchmarks_protoc_outputs_header)
483483

484-
484+
485485
############ UTIL RULES END ############
486486

487487
############ PROTO3 PREPARATION BEGIN #############
@@ -510,7 +510,7 @@ proto3_middleman_php: proto3_proto_middleman
510510

511511
php-benchmark: proto3_middleman_php generate_proto3_data
512512
mkdir -p "tmp/php/Google/Protobuf/Benchmark" && cp php/PhpBenchmark.php "tmp/php/Google/Protobuf/Benchmark"
513-
cp php/autoload.php "tmp/php"
513+
cp php/autoload.php "tmp/php"
514514
@echo "Writing shortcut script php-benchmark..."
515515
@echo '#! /bin/bash' > php-benchmark
516516
@echo 'export PROTOBUF_PHP_SRCDIR="$$(cd $(top_srcdir) && pwd)/php/src"' >> php-benchmark
@@ -527,8 +527,8 @@ php_c_extension:
527527
cd $(top_srcdir)/php/ext/google/protobuf && phpize && ./configure CFLAGS='-O3' && make -j8
528528

529529
php-c-benchmark: proto3_middleman_php generate_proto3_data php_c_extension php_c_extension
530-
mkdir -p "tmp/php/Google/Protobuf/Benchmark" && cp php/PhpBenchmark.php "tmp/php/Google/Protobuf/Benchmark"
531-
cp php/autoload.php "tmp/php"
530+
mkdir -p "tmp/php/Google/Protobuf/Benchmark" && cp php/PhpBenchmark.php "tmp/php/Google/Protobuf/Benchmark"
531+
cp php/autoload.php "tmp/php"
532532
@echo "Writing shortcut script php-c-benchmark..."
533533
@echo '#! /bin/bash' > php-c-benchmark
534534
@echo 'export PROTOBUF_PHP_SRCDIR="$$(cd $(top_srcdir) && pwd)/php/src"' >> php-c-benchmark
@@ -654,4 +654,4 @@ CLEANFILES = \
654654

655655
clean-local:
656656
-rm -rf tmp/*
657-
657+

benchmarks/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
This directory contains benchmarking schemas and data sets that you
55
can use to test a variety of performance scenarios against your
6-
protobuf language runtime. If you are looking for performance
6+
protobuf language runtime. If you are looking for performance
77
numbers of officially support languages, see [here](
88
https://github.com/protocolbuffers/protobuf/blob/master/docs/performance.md)
99

@@ -45,8 +45,8 @@ And you also need to make sure `pkg-config` is installed.
4545

4646
### Go
4747
Go protobufs are maintained at [github.com/golang/protobuf](
48-
http://github.com/golang/protobuf). If not done already, you need to install the
49-
toolchain and the Go protoc-gen-go plugin for protoc.
48+
http://github.com/golang/protobuf). If not done already, you need to install the
49+
toolchain and the Go protoc-gen-go plugin for protoc.
5050

5151
To install protoc-gen-go, run:
5252

@@ -59,7 +59,7 @@ The first command installs `protoc-gen-go` into the `bin` directory in your loca
5959
The second command adds the `bin` directory to your `PATH` so that `protoc` can locate the plugin later.
6060

6161
### PHP
62-
PHP benchmark's requirement is the same as PHP protobuf's requirements. The benchmark will automaticly
62+
PHP benchmark's requirement is the same as PHP protobuf's requirements. The benchmark will automaticly
6363
include PHP protobuf's src and build the c extension if required.
6464

6565
### Node.js

benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
import java.util.List;
2525

2626
// Caliper set CICompilerCount to 1 for making sure compilation doesn't run in parallel with itself,
27-
// This makes TieredCompilation not working. We just disable TieredCompilation by default. In master
28-
// branch this has been disabled by default in caliper:
27+
// This makes TieredCompilation not working. We just disable TieredCompilation by default. In master
28+
// branch this has been disabled by default in caliper:
2929
// https://github.com/google/caliper/blob/master/caliper-runner/src/main/java/com/google/caliper/runner/target/Jvm.java#L38:14
3030
// But this haven't been added into most recent release.
3131
@VmOptions("-XX:-TieredCompilation")
@@ -89,15 +89,15 @@ Message getDefaultInstance() {
8989
return com.google.protobuf.benchmarks.BenchmarkMessage4.GoogleMessage4.getDefaultInstance();
9090
}
9191
};
92-
92+
9393
abstract ExtensionRegistry getExtensionRegistry();
9494
abstract Message getDefaultInstance();
9595
}
9696

9797
private BenchmarkMessageType benchmarkMessageType;
9898
@Param("")
9999
private String dataFile;
100-
100+
101101
private byte[] inputData;
102102
private BenchmarkDataset benchmarkDataset;
103103
private Message defaultMessage;
@@ -125,7 +125,7 @@ private BenchmarkMessageType getMessageType() throws IOException {
125125
+ benchmarkDataset.getMessageName());
126126
}
127127
}
128-
128+
129129
@BeforeExperiment
130130
void setUp() throws IOException {
131131
if (!dataFile.equals("")) {
@@ -145,7 +145,7 @@ void setUp() throws IOException {
145145
inputStreamList = new ArrayList<ByteArrayInputStream>();
146146
inputStringList = new ArrayList<ByteString>();
147147
sampleMessageList = new ArrayList<Message>();
148-
148+
149149
for (int i = 0; i < benchmarkDataset.getPayloadCount(); i++) {
150150
byte[] singleInputData = benchmarkDataset.getPayload(i).toByteArray();
151151
inputDataList.add(benchmarkDataset.getPayload(i).toByteArray());
@@ -156,20 +156,20 @@ void setUp() throws IOException {
156156
defaultMessage.newBuilderForType().mergeFrom(singleInputData, extensions).build());
157157
}
158158
}
159-
160-
159+
160+
161161
@Benchmark
162162
void serializeToByteArray(int reps) throws IOException {
163163
if (sampleMessageList.size() == 0) {
164164
return;
165165
}
166166
for (int i = 0; i < reps; i++) {
167167
for (int j = 0; j < sampleMessageList.size(); j++) {
168-
sampleMessageList.get(j).toByteArray();
168+
sampleMessageList.get(j).toByteArray();
169169
}
170170
}
171171
}
172-
172+
173173
@Benchmark
174174
void serializeToMemoryStream(int reps) throws IOException {
175175
if (sampleMessageList.size() == 0) {
@@ -178,11 +178,11 @@ void serializeToMemoryStream(int reps) throws IOException {
178178
for (int i = 0; i < reps; i++) {
179179
for (int j = 0; j < sampleMessageList.size(); j++) {
180180
ByteArrayOutputStream output = new ByteArrayOutputStream();
181-
sampleMessageList.get(j).writeTo(output);
181+
sampleMessageList.get(j).writeTo(output);
182182
}
183183
}
184184
}
185-
185+
186186
@Benchmark
187187
void deserializeFromByteArray(int reps) throws IOException {
188188
if (inputDataList.size() == 0) {
@@ -195,7 +195,7 @@ void deserializeFromByteArray(int reps) throws IOException {
195195
}
196196
}
197197
}
198-
198+
199199
@Benchmark
200200
void deserializeFromMemoryStream(int reps) throws IOException {
201201
if (inputStreamList.size() == 0) {

benchmarks/js/benchmark_suite.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ function newBenchmark(messageName, filename, language) {
99
})
1010
.on("start", function() {
1111
process.stdout.write(
12-
"benchmarking message " + messageName
13-
+ " of dataset file " + filename
12+
"benchmarking message " + messageName
13+
+ " of dataset file " + filename
1414
+ "'s performance ..." + "\n\n");
1515
})
1616
.on("cycle", function(event) {
@@ -21,7 +21,7 @@ function newBenchmark(messageName, filename, language) {
2121
return 1 / (bench.stats.mean + bench.stats.moe);
2222
}
2323
benches.forEach(function(val, index) {
24-
benches[index] = getHz(val);
24+
benches[index] = getHz(val);
2525
});
2626
}),
2727
benches: benches

benchmarks/js/js_benchmark.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ process.argv.forEach(function(filename, index) {
3030
json_file = filename.replace(/^--json_output=/, '');
3131
return;
3232
}
33-
33+
3434
var benchmarkDataset =
3535
proto.benchmarks.BenchmarkDataset.deserializeBinary(fs.readFileSync(filename));
3636
var messageList = [];
@@ -40,22 +40,22 @@ process.argv.forEach(function(filename, index) {
4040
messageList.push(message.deserializeBinary(onePayload));
4141
totalBytes += onePayload.length;
4242
});
43-
43+
4444
var senarios = benchmarkSuite.newBenchmark(
4545
benchmarkDataset.getMessageName(), filename, "js");
4646
senarios.suite
4747
.add("js deserialize", function() {
4848
benchmarkDataset.getPayloadList().forEach(function(onePayload) {
4949
var protoType = getNewPrototype(benchmarkDataset.getMessageName());
5050
protoType.deserializeBinary(onePayload);
51-
});
51+
});
5252
})
5353
.add("js serialize", function() {
5454
var protoType = getNewPrototype(benchmarkDataset.getMessageName());
5555
messageList.forEach(function(message) {
5656
message.serializeBinary();
5757
});
58-
})
58+
})
5959
.run({"Async": false});
6060

6161
results.push({
@@ -66,9 +66,9 @@ process.argv.forEach(function(filename, index) {
6666
}
6767
})
6868

69-
console.log("Throughput for deserialize: "
69+
console.log("Throughput for deserialize: "
7070
+ senarios.benches[0] * totalBytes / 1024 / 1024 + "MB/s" );
71-
console.log("Throughput for serialize: "
71+
console.log("Throughput for serialize: "
7272
+ senarios.benches[1] * totalBytes / 1024 / 1024 + "MB/s" );
7373
console.log("");
7474
});

benchmarks/php/PhpBenchmark.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static function parse(&$args) {
3333
(new $args[1]())->mergeFromString($payloads->offsetGet($i));
3434
}
3535
}
36-
36+
3737
// $args: array of message
3838
static function serialize(&$args) {
3939
foreach ($args as &$temp_message) {
@@ -49,7 +49,7 @@ class Benchmark
4949
private $benchmark_time;
5050
private $total_bytes;
5151
private $coefficient;
52-
52+
5353
public function __construct($benchmark_name, $args, $total_bytes,
5454
$benchmark_time = 5.0) {
5555
$this->args = $args;
@@ -58,15 +58,15 @@ public function __construct($benchmark_name, $args, $total_bytes,
5858
$this->total_bytes = $total_bytes;
5959
$this->coefficient = pow (10, 0) / pow(2, 20);
6060
}
61-
61+
6262
public function runBenchmark() {
6363
$t = $this->runBenchmarkWithTimes(1);
6464
$times = ceil($this->benchmark_time / $t);
6565
return $this->total_bytes * $times /
6666
($times == 1 ? $t : $this->runBenchmarkWithTimes($times)) *
6767
$this->coefficient;
6868
}
69-
69+
7070
private function runBenchmarkWithTimes($times) {
7171
$st = microtime(true);
7272
for ($i = 0; $i < $times; $i++) {
@@ -109,14 +109,14 @@ function runBenchmark($file, $behavior_prefix) {
109109
array_push($message_list, $new_message);
110110
$total_bytes += strlen($payloads->offsetGet($i));
111111
}
112-
112+
113113
$parse_benchmark = new Benchmark(
114114
"\Google\Protobuf\Benchmark\BenchmarkMethod::parse",
115115
array($dataset, $message_name), $total_bytes);
116116
$serialize_benchmark = new Benchmark(
117117
"\Google\Protobuf\Benchmark\BenchmarkMethod::serialize",
118118
$message_list, $total_bytes);
119-
119+
120120
return array(
121121
"filename" => $file,
122122
"benchmarks" => array(
@@ -139,7 +139,7 @@ function runBenchmark($file, $behavior_prefix) {
139139
if ($arg == "--json") {
140140
$json_output = true;
141141
} else if (strpos($arg, "--behavior_prefix") == 0) {
142-
$behavior_prefix = str_replace("--behavior_prefix=", "", $arg);
142+
$behavior_prefix = str_replace("--behavior_prefix=", "", $arg);
143143
}
144144
}
145145

0 commit comments

Comments
 (0)