Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Master #40

Merged
merged 16 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 19 additions & 0 deletions .github/workflows/benchmarks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Benchmarks

on: [pull_request]

jobs:
vtproto-golang:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
check-latest: true
cache: true
- name: Run Benchmarks
run: make benchmark-polyglot
working-directory: benchmarks
26 changes: 24 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [v1.2.2] - 2024-03-26

### Fixes

- Fixed a bug in Polyglot Go where the capacity of the buffer would not grow properly resulting in silent short writes and corrupted data

## [v1.2.1] - 2024-03-12

### Changes

- Made Buffer.Grow() in the Polyglot Go library public

## [v1.2.0] - 2024-03-14

### Changes

- Updated the names of error values in Go to fit with Go's standard code-style conventions
- Significant performance improvements for the Golang implementation

## [v1.1.4] - 2023-10-12

### Fixes
Expand Down Expand Up @@ -45,9 +64,12 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

- Merging Typescript, Golang, and Rust implementations into a single repository

[unreleased]: https://github.com/loopholelabs/scale/compare/v1.1.4...HEAD
[unreleased]: https://github.com/loopholelabs/scale/compare/v1.2.2...HEAD
[v1.2.2]: https://github.com/loopholelabs/scale/compare/v1.2.2
[v1.2.1]: https://github.com/loopholelabs/scale/compare/v1.2.1
[v1.2.0]: https://github.com/loopholelabs/scale/compare/v1.2.0
[v1.1.4]: https://github.com/loopholelabs/scale/compare/v1.1.4
[v1.1.3]: https://github.com/loopholelabs/scale/compare/v1.1.3
[v1.1.2]: https://github.com/loopholelabs/scale/compare/v1.1.2
[v1.1.1]: https://github.com/loopholelabs/scale/compare/v1.1.1
[v1.1.0]: https://github.com/loopholelabs/scale/compare/v1.1.0
[v1.1.0]: https://github.com/loopholelabs/scale/compare/v1.1.0
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "polyglot_rs"
version = "1.1.4"
version = "1.2.2"
edition = "2021"
description="A high-performance serialization framework used for encoding and decoding arbitrary datastructures across languages."
license = "Apache-2.0"
Expand Down
43 changes: 43 additions & 0 deletions benchmarks/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
BENCHCOUNT ?= 10

install:
- go install ../protoc-gen-go-polyglot
- go install github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto@latest
- go install google.golang.org/protobuf/cmd/[email protected]

generate:
- mkdir -p polyglot
- protoc --go-polyglot_out=polyglot bench.proto
- mkdir -p vtproto
- protoc --go_out=vtproto --go-vtproto_out=vtproto bench.proto

benchmark-polyglot: benchmark-polyglot-cmp
- go run -mod=mod golang.org/x/perf/cmd/benchstat bench.txt
- go mod tidy
- rm -rf bench.txt

benchmark-polyglot-cmp:
- go test -bench=. -timeout=24h -count=$(BENCHCOUNT) ./... -test.short | tee bench.txt

benchmark-polyglot-long:
- go test -bench=. -timeout=24h -count=$(BENCHCOUNT) ./... | tee bench.txt
- go run -mod=mod golang.org/x/perf/cmd/benchstat bench.txt
- go mod tidy
- rm -rf bench.txt

benchmark-vtproto: benchmark-vtproto-cmp
- go run -mod=mod golang.org/x/perf/cmd/benchstat bench.txt
- go mod tidy
- rm -rf bench.txt

benchmark-vtproto-cmp:
- go test -bench=. -timeout=24h -count=$(BENCHCOUNT) ./... -tags=vtproto -test.short | tee bench.txt

benchmark-vtproto-long:
- go test -bench=. -timeout=24h -count=$(BENCHCOUNT) ./... -tags=vtproto | tee bench.txt
- go run -mod=mod golang.org/x/perf/cmd/benchstat bench.txt
- go mod tidy
- rm -rf bench.txt

leaks:
- go test -bench=. -gcflags="-m=2" ./...
25 changes: 25 additions & 0 deletions benchmarks/bench.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
syntax = "proto3";

option go_package = "./benchmark";

message BytesData {
bytes bytes = 1;
}

message I32Data {
int32 i32 = 1;
}

message U32Data {
uint32 u32 = 1;
}

message I64Data {
int64 i64 = 1;
}

message U64Data {
uint64 u64 = 1;
}

service Benchmark {}
19 changes: 19 additions & 0 deletions benchmarks/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module benchmark

go 1.20

replace github.com/loopholelabs/polyglot => ../

require (
github.com/loopholelabs/polyglot v1.2.2
google.golang.org/grpc v1.59.0
google.golang.org/protobuf v1.33.0
)

require (
github.com/golang/protobuf v1.5.3 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect; indirect..
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect
)
24 changes: 24 additions & 0 deletions benchmarks/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b h1:ZlWIi1wSK56/8hn4QcBp/j9M7Gt3U/3hZw3mC7vDICo=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:swOH3j0KzcDDgGUWr+SNpyTen5YrXjS3eyPzFYKc6lc=
google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk=
google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Loading
Loading