Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
3775eb2
WIP
osa1 Jun 28, 2022
00a46ea
Fix compile_protos.sh
osa1 Jun 28, 2022
3401c33
Copy common code
osa1 Jun 28, 2022
6afbd6f
Add query_benchmark encode/decode benchmarks
osa1 Jun 28, 2022
a7a8061
Add query_benchmark set_nested_value
osa1 Jun 28, 2022
8acb3cc
Add protobuf_benchmarks decode benchmark
osa1 Jun 28, 2022
5532e13
Fixups
osa1 Jun 28, 2022
b8eeb2e
Add another bench
osa1 Jun 28, 2022
d2598b1
Another bench
osa1 Jun 28, 2022
9aa9e59
More benches
osa1 Jun 28, 2022
5398c17
Up
osa1 Jun 28, 2022
b4e0a77
Add hash code bench
osa1 Jun 28, 2022
76ecf29
Remove unused file
osa1 Jun 28, 2022
e177125
Update bench names
osa1 Jun 28, 2022
e45f7c8
Remove old benchmarks
osa1 Jun 28, 2022
e11e12a
Merge remote-tracking branch 'origin/master' into refactor_benchmarks
osa1 Jun 28, 2022
db19e75
Update workflow
osa1 Jun 28, 2022
b212ffc
Remove late vars
osa1 Jun 28, 2022
b17ecfd
Move scripts to tool/, add mono_repo
osa1 Jun 28, 2022
51e9fad
Add a tool to compile benchmarks
osa1 Jun 28, 2022
61fa212
Add script to compile benchmarks faster
osa1 Jun 28, 2022
3d81be5
Divide query_benchmark results by 10 to be compatible with old results
osa1 Jun 28, 2022
ce60860
Fix warnings
osa1 Jun 28, 2022
1902aca
Add README
osa1 Jun 28, 2022
1b567e9
Fix readme formatting
osa1 Jun 28, 2022
5256dad
Commit pubspec.yaml
osa1 Jun 28, 2022
ee2320a
Update `QueryBenchmark` documentation
osa1 Jun 29, 2022
97b137b
Remove compile_benchmark.sh, update README
osa1 Jun 29, 2022
0075b98
Report accurate results in all benchmarks, enable linter
osa1 Jun 29, 2022
fdd1c7e
Update copyright years in tool/
osa1 Jun 29, 2022
d058236
compile_benchmarks.py: Do not spawn more processes than number of CPUs
osa1 Jun 29, 2022
9c1cf13
compile_benchamrks.py: Update comments
osa1 Jun 29, 2022
eae565b
compile_benchmarks.py: Exit with 1 when a subprocess fails
osa1 Jun 29, 2022
83c3f5f
Implement benchmark builder in Dart
osa1 Jun 29, 2022
1f627fd
Remove compile_benchmarks.py, update Dart script
osa1 Jun 29, 2022
6e78ad8
Update README
osa1 Jun 29, 2022
9e37586
Update an error message
osa1 Jun 29, 2022
98800c8
Make some vars final
osa1 Jun 30, 2022
0c1a928
Remove a dynamic cast
osa1 Jun 30, 2022
2ef63b4
Print process stdout and stderr on failure
osa1 Jun 30, 2022
adf1109
Remove redundant `async`
osa1 Jun 30, 2022
424ac75
Rename aot -> exe
osa1 Jun 30, 2022
df3ae16
Create 'out' directory before compilation
osa1 Jun 30, 2022
da2f87a
Add aot target
osa1 Jun 30, 2022
3790230
Only try to compile Dart files
osa1 Jun 30, 2022
39da206
Merge remote-tracking branch 'origin/master' into refactor_benchmarks
osa1 Jul 4, 2022
2f19d56
Update dill file name
osa1 Jul 4, 2022
5156dd2
Add js-production mode
osa1 Jul 4, 2022
933086b
Add proto3 JSON object parsing benchmark
osa1 Jul 4, 2022
de6a05f
Fix warnings
osa1 Jul 4, 2022
847124a
Update benchmark names
osa1 Jul 5, 2022
f6c00c3
Remove silly comment
osa1 Jul 5, 2022
f5f3344
Refactor file list initialization
osa1 Jul 5, 2022
751e661
Use -O4 in JS production mode
osa1 Jul 5, 2022
98b0e84
Fix type error
osa1 Jul 5, 2022
f2e0fe7
Show failing command when a process fails
osa1 Jul 5, 2022
2d14348
Merge remote-tracking branch 'origin/master' into refactor_benchmarks
osa1 Jul 6, 2022
c427802
Report file system errors when creating out dir
osa1 Jul 6, 2022
a01c866
Add protoc_version file for Golem
osa1 Jul 6, 2022
ed89a19
Remove _benchmark_ in query benchmark names
osa1 Jul 6, 2022
5e9862b
Report benchmark results as RunTimeRaw instead of RunTime
osa1 Jul 6, 2022
aecc575
Add "protobuf_" prefix to test names
osa1 Jul 7, 2022
665d291
Merge remote-tracking branch 'origin/master' into refactor_benchmarks
osa1 Jul 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 59 additions & 32 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ jobs:
working-directory: protobuf
run: dart analyze test
job_003:
name: "format_analyze; linux; Dart dev; PKGS: api_benchmark, query_benchmark; `dart format --output=none --set-exit-if-changed .`, `./../tool/setup.sh`, `./compile_protos.sh`, `dart analyze --fatal-infos`"
name: "format_analyze; linux; Dart dev; PKG: api_benchmark; `dart format --output=none --set-exit-if-changed .`, `./../tool/setup.sh`, `./compile_protos.sh`, `dart analyze --fatal-infos`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@v3
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:api_benchmark-query_benchmark;commands:format-command_0-command_1-analyze_0"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:api_benchmark;commands:format-command_0-command_1-analyze_0"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:api_benchmark-query_benchmark
os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:api_benchmark
os:ubuntu-latest;pub-cache-hosted;sdk:dev
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
Expand Down Expand Up @@ -107,28 +107,47 @@ jobs:
if: "always() && steps.api_benchmark_pub_upgrade.conclusion == 'success'"
working-directory: api_benchmark
run: dart analyze --fatal-infos
- id: query_benchmark_pub_upgrade
name: query_benchmark; dart pub upgrade
job_004:
name: "format_analyze; linux; Dart dev; PKG: benchmarks; `dart format --output=none --set-exit-if-changed .`, `./../tool/setup.sh`, `./tool/compile_protos.sh`, `dart analyze --fatal-infos`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@v3
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:benchmarks;commands:format-command_0-command_2-analyze_0"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:benchmarks
os:ubuntu-latest;pub-cache-hosted;sdk:dev
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: dart-lang/[email protected]
with:
sdk: dev
- id: checkout
uses: actions/[email protected]
- id: benchmarks_pub_upgrade
name: benchmarks; dart pub upgrade
if: "always() && steps.checkout.conclusion == 'success'"
working-directory: query_benchmark
working-directory: benchmarks
run: dart pub upgrade
- name: "query_benchmark; dart format --output=none --set-exit-if-changed ."
if: "always() && steps.query_benchmark_pub_upgrade.conclusion == 'success'"
working-directory: query_benchmark
- name: "benchmarks; dart format --output=none --set-exit-if-changed ."
if: "always() && steps.benchmarks_pub_upgrade.conclusion == 'success'"
working-directory: benchmarks
run: "dart format --output=none --set-exit-if-changed ."
- name: query_benchmark; ./../tool/setup.sh
if: "always() && steps.query_benchmark_pub_upgrade.conclusion == 'success'"
working-directory: query_benchmark
- name: benchmarks; ./../tool/setup.sh
if: "always() && steps.benchmarks_pub_upgrade.conclusion == 'success'"
working-directory: benchmarks
run: ./../tool/setup.sh
- name: query_benchmark; ./compile_protos.sh
if: "always() && steps.query_benchmark_pub_upgrade.conclusion == 'success'"
working-directory: query_benchmark
run: ./compile_protos.sh
- name: "query_benchmark; dart analyze --fatal-infos"
if: "always() && steps.query_benchmark_pub_upgrade.conclusion == 'success'"
working-directory: query_benchmark
- name: benchmarks; ./tool/compile_protos.sh
if: "always() && steps.benchmarks_pub_upgrade.conclusion == 'success'"
working-directory: benchmarks
run: ./tool/compile_protos.sh
- name: "benchmarks; dart analyze --fatal-infos"
if: "always() && steps.benchmarks_pub_upgrade.conclusion == 'success'"
working-directory: benchmarks
run: dart analyze --fatal-infos
job_004:
job_005:
name: "format_analyze; linux; Dart dev; PKG: protobuf; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos`"
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -160,15 +179,15 @@ jobs:
if: "always() && steps.protobuf_pub_upgrade.conclusion == 'success'"
working-directory: protobuf
run: dart analyze --fatal-infos
job_005:
job_006:
name: "format_analyze; linux; Dart dev; PKG: protoc_plugin; `dart format --output=none --set-exit-if-changed .`, `./../tool/setup.sh`, `make protos`, `dart analyze --fatal-infos`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@v3
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protoc_plugin;commands:format-command_0-command_2-analyze_0"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protoc_plugin;commands:format-command_0-command_3-analyze_0"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protoc_plugin
os:ubuntu-latest;pub-cache-hosted;sdk:dev
Expand Down Expand Up @@ -200,7 +219,7 @@ jobs:
if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'"
working-directory: protoc_plugin
run: dart analyze --fatal-infos
job_006:
job_007:
name: "run_tests; linux; Dart 2.12.0; PKG: protobuf; `dart test`"
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -234,15 +253,16 @@ jobs:
- job_003
- job_004
- job_005
job_007:
- job_006
job_008:
name: "run_tests; linux; Dart 2.12.0; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@v3
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.12.0;packages:protoc_plugin;commands:command_0-command_2-test"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.12.0;packages:protoc_plugin;commands:command_0-command_3-test"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:2.12.0;packages:protoc_plugin
os:ubuntu-latest;pub-cache-hosted;sdk:2.12.0
Expand Down Expand Up @@ -276,7 +296,8 @@ jobs:
- job_003
- job_004
- job_005
job_008:
- job_006
job_009:
name: "run_tests; linux; Dart dev; PKG: protobuf; `dart test`"
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -310,15 +331,16 @@ jobs:
- job_003
- job_004
- job_005
job_009:
- job_006
job_010:
name: "run_tests; linux; Dart dev; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@v3
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protoc_plugin;commands:command_0-command_2-test"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protoc_plugin;commands:command_0-command_3-test"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protoc_plugin
os:ubuntu-latest;pub-cache-hosted;sdk:dev
Expand Down Expand Up @@ -352,7 +374,8 @@ jobs:
- job_003
- job_004
- job_005
job_010:
- job_006
job_011:
name: "run_tests; osx; Dart 2.12.0; PKG: protobuf; `dart test`"
runs-on: macos-latest
steps:
Expand Down Expand Up @@ -386,7 +409,8 @@ jobs:
- job_003
- job_004
- job_005
job_011:
- job_006
job_012:
name: "run_tests; osx; Dart dev; PKG: protobuf; `dart test`"
runs-on: macos-latest
steps:
Expand Down Expand Up @@ -420,7 +444,8 @@ jobs:
- job_003
- job_004
- job_005
job_012:
- job_006
job_013:
name: "run_tests; windows; Dart 2.12.0; PKG: protobuf; `dart test`"
runs-on: windows-latest
steps:
Expand All @@ -444,7 +469,8 @@ jobs:
- job_003
- job_004
- job_005
job_013:
- job_006
job_014:
name: "run_tests; windows; Dart dev; PKG: protobuf; `dart test`"
runs-on: windows-latest
steps:
Expand All @@ -468,3 +494,4 @@ jobs:
- job_003
- job_004
- job_005
- job_006
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ build/
**/lib/generated/**
packages
pubspec.lock
benchmarks/out
20 changes: 20 additions & 0 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Running benchmarks

- Compile protos with `./tool/compile_protos.sh`

- **JIT:** Run benchmark programs in `bin/`, e.g. `dart bin/from_binary.dart`

- **AOT and JS:**

- Compile benchmark programs to native, JS, and JIT snapshots with
`./tool/compile_benchmarks.dart`

- Run benchmark programs in `out/`:
- AOT: `./out/from_binary.exe`
- JS: `d8 $DART_SDK/lib/_internal/js_runtime/lib/preambles/d8.js out/from_binary.js`

## Development

`protoc_version` file specifies the version of protoc Golem will use when
building the benchmarks, and allows updating the protoc version without
changing Golem.
5 changes: 5 additions & 0 deletions benchmarks/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include: package:lints/recommended.yaml

linter:
rules:
- directives_ordering
44 changes: 44 additions & 0 deletions benchmarks/bin/from_binary.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:typed_data';

import 'package:protobuf_benchmarks/benchmark_base.dart';
import 'package:protobuf_benchmarks/generated/google_message1_proto2.pb.dart'
as p2;
import 'package:protobuf_benchmarks/generated/google_message1_proto3.pb.dart'
as p3;
import 'package:protobuf_benchmarks/generated/google_message2.pb.dart';
import 'package:protobuf_benchmarks/readfile.dart';

class Benchmark extends BenchmarkBase {
final Uint8List _message1Proto2Input;
final Uint8List _message1Proto3Input;
final Uint8List _message2Input;

Benchmark(String name, List<int> message1Proto2Input,
List<int> message1Proto3Input, List<int> message2Input)
: _message1Proto2Input = Uint8List.fromList(message1Proto2Input),
_message1Proto3Input = Uint8List.fromList(message1Proto3Input),
_message2Input = Uint8List.fromList(message2Input),
super(name);

@override
void run() {
p2.GoogleMessage1.fromBuffer(_message1Proto2Input);
p3.GoogleMessage1.fromBuffer(_message1Proto3Input);
GoogleMessage2.fromBuffer(_message2Input);
}
}

void main() {
List<int> message1Proto2Input =
readfile('datasets/google_message1_proto2.pb');
List<int> message1Proto3Input =
readfile('datasets/google_message1_proto3.pb');
List<int> message2Input = readfile('datasets/google_message2.pb');
Benchmark('from_binary', message1Proto2Input, message1Proto3Input,
message2Input)
.report();
}
45 changes: 45 additions & 0 deletions benchmarks/bin/from_json_string.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:protobuf_benchmarks/benchmark_base.dart';
import 'package:protobuf_benchmarks/generated/google_message1_proto2.pb.dart'
as p2;
import 'package:protobuf_benchmarks/generated/google_message1_proto3.pb.dart'
as p3;
import 'package:protobuf_benchmarks/generated/google_message2.pb.dart';
import 'package:protobuf_benchmarks/readfile.dart';

class Benchmark extends BenchmarkBase {
final String _message1Proto2JsonString;
final String _message1Proto3JsonString;
final String _message2JsonString;

Benchmark(String name, List<int> message1Proto2Input,
List<int> message1Proto3Input, List<int> message2Input)
: _message1Proto2JsonString =
p2.GoogleMessage1.fromBuffer(message1Proto2Input).writeToJson(),
_message1Proto3JsonString =
p3.GoogleMessage1.fromBuffer(message1Proto3Input).writeToJson(),
_message2JsonString =
GoogleMessage2.fromBuffer(message2Input).writeToJson(),
super(name);

@override
void run() {
p2.GoogleMessage1.fromJson(_message1Proto2JsonString);
p3.GoogleMessage1.fromJson(_message1Proto3JsonString);
GoogleMessage2.fromJson(_message2JsonString);
}
}

void main() {
List<int> message1Proto2Input =
readfile('datasets/google_message1_proto2.pb');
List<int> message1Proto3Input =
readfile('datasets/google_message1_proto3.pb');
List<int> message2Input = readfile('datasets/google_message2.pb');
Benchmark('from_json_string', message1Proto2Input, message1Proto3Input,
message2Input)
.report();
}
47 changes: 47 additions & 0 deletions benchmarks/bin/from_proto3_json_object.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:protobuf_benchmarks/benchmark_base.dart';
import 'package:protobuf_benchmarks/generated/google_message1_proto2.pb.dart'
as p2;
import 'package:protobuf_benchmarks/generated/google_message1_proto3.pb.dart'
as p3;
import 'package:protobuf_benchmarks/generated/google_message2.pb.dart';
import 'package:protobuf_benchmarks/readfile.dart';

class Benchmark extends BenchmarkBase {
final Object? _message1Proto2Proto3JsonObject;
final Object? _message1Proto3Proto3JsonObject;
final Object? _message2Proto3JsonObject;

Benchmark(String name, List<int> message1Proto2Input,
List<int> message1Proto3Input, List<int> message2Input)
: _message1Proto2Proto3JsonObject =
p2.GoogleMessage1.fromBuffer(message1Proto2Input).toProto3Json(),
_message1Proto3Proto3JsonObject =
p3.GoogleMessage1.fromBuffer(message1Proto3Input).toProto3Json(),
_message2Proto3JsonObject =
GoogleMessage2.fromBuffer(message2Input).toProto3Json(),
super(name);

@override
void run() {
p2.GoogleMessage1.create()
.mergeFromProto3Json(_message1Proto2Proto3JsonObject);
p3.GoogleMessage1.create()
.mergeFromProto3Json(_message1Proto3Proto3JsonObject);
GoogleMessage2.create().mergeFromProto3Json(_message2Proto3JsonObject);
}
}

void main() {
List<int> message1Proto2Input =
readfile('datasets/google_message1_proto2.pb');
List<int> message1Proto3Input =
readfile('datasets/google_message1_proto3.pb');
List<int> message2Input = readfile('datasets/google_message2.pb');
Benchmark('from_proto3_json_object', message1Proto2Input, message1Proto3Input,
message2Input)
.report();
}
Loading