Skip to content

Commit

Permalink
First pass at benchmarking for C#
Browse files Browse the repository at this point in the history
  • Loading branch information
jskeet committed Mar 13, 2019
1 parent db1d4dc commit 233f486
Show file tree
Hide file tree
Showing 10 changed files with 2,541 additions and 6 deletions.
17 changes: 16 additions & 1 deletion benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ include PHP protobuf's src and build the c extension if required.
### Node.js
Node.js benchmark need [node](https://nodejs.org/en/)(higher than V6) and [npm](https://www.npmjs.com/) package manager installed. This benchmark is using the [benchmark](https://www.npmjs.com/package/benchmark) framework to test, which needn't to manually install. And another prerequisite is [protobuf js](https://github.com/protocolbuffers/protobuf/tree/master/js), which needn't to manually install either

### C#
The C# benchmark code is built as part of the main Google.Protobuf
solution. It requires the .NET Core SDK, and depends on
[BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet), which
will be downloaded automatically.

### Big data

There's some optional big testing data which is not included in the directory
Expand All @@ -74,7 +80,7 @@ initially, you need to run the following command to download the testing data:
$ ./download_data.sh
```

After doing this the big data file will automaticly generated in the
After doing this the big data file will automatically generated in the
benchmark directory.

## Run instructions
Expand Down Expand Up @@ -209,6 +215,15 @@ $ make js-benchmark
$ ./js-benchmark $(specific generated dataset file name)
```

### C#
From `csharp/src/Google.Protobuf.Benchmarks`, run:

```
$ dotnet run -c Release
```

We intend to add support for this within the makefile in due course.

## Benchmark datasets

Each data set is in the format of benchmarks.proto:
Expand Down
3 changes: 3 additions & 0 deletions csharp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ mono/*.exe
mono/*.dll
lib/protoc.exe
*.ncrunch*

# Benchmark output
BenchmarkDotNet.Artifacts/
6 changes: 6 additions & 0 deletions csharp/generate_protos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,9 @@ $PROTOC -Iexamples -Isrc --csharp_out=csharp/src/AddressBook \

$PROTOC -Iconformance -Isrc --csharp_out=csharp/src/Google.Protobuf.Conformance \
conformance/conformance.proto

# Benchmark protos
$PROTOC -Ibenchmarks \
benchmarks/datasets/google_message1/proto3/*.proto \
benchmarks/benchmarks.proto \
--csharp_out=csharp/src/Google.Protobuf.Benchmarks
Loading

0 comments on commit 233f486

Please sign in to comment.