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

SignedBlindedBeaconBlock SSZ + Benchmark SSZ vs JSON #50

Merged
merged 1 commit into from
Oct 6, 2022

Conversation

metachris
Copy link
Collaborator

@metachris metachris commented Oct 6, 2022

📝 Summary

  • Added SSZ for SignedBlindedBeaconBlock
  • Benchmarking SSZ vs JSON encoding and decoding of SignedBlindedBeaconBlock
$ go test -benchmem -run=^$ -bench ^BenchmarkJSONvsSSZEncoding$ github.com/flashbots/go-boost-utils/types

goos: darwin
goarch: arm64
pkg: github.com/flashbots/go-boost-utils/types
BenchmarkJSONvsSSZEncoding/Encode_JSON-10         	   18561	     62939 ns/op	   50754 B/op	     274 allocs/op
BenchmarkJSONvsSSZEncoding/Encode_SSZ-10          	  855457	      1368 ns/op	    9472 B/op	       1 allocs/op
BenchmarkJSONvsSSZEncoding/Decode_JSON-10         	    7621	    153292 ns/op	   30433 B/op	     613 allocs/op
BenchmarkJSONvsSSZEncoding/Decode_SSZ-10          	  276904	      3968 ns/op	   10116 B/op	     152 allocs/op

Looks like SSZ encoding/decoding is about 40-50x faster.


✅ I have run these commands

  • make lint
  • make test
  • go mod tidy

@metachris metachris changed the title Benchmark ssz vs json encoding and decoding SignedBlindedBeaconBlock SSZ + Benchmark SSZ vs JSON encoding and decoding Oct 6, 2022
Copy link
Collaborator

@jtraglia jtraglia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Quite the difference in performance.

@metachris metachris merged commit 25dcc83 into main Oct 6, 2022
@metachris metachris deleted the benchmark-ssz-vs-json branch October 6, 2022 19:31
@metachris metachris changed the title SignedBlindedBeaconBlock SSZ + Benchmark SSZ vs JSON encoding and decoding SignedBlindedBeaconBlock SSZ + Benchmark SSZ vs JSON Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants