From 166f7e31727197ea32b165dfbc4386f2dc57632f Mon Sep 17 00:00:00 2001 From: Matheus Degiovani Date: Wed, 19 Jun 2024 14:44:02 -0300 Subject: [PATCH] readme: Update with new serializer instructions --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index 7776e6c..56c66aa 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,13 @@ To update the benchmark report: go test -tags genreport -run TestGenerateReport ``` +To update the benchmark report with using a longer run benchmark (to get more +accurate results): + +```bash +go test -tags genreport -run TestGenerateReport -benchtime 10s -timeout 1h +``` + ## Recommendation If correctness and interoperability are the most @@ -33,6 +40,32 @@ important factors [JSON](http://golang.org/pkg/encoding/json/) or [Protobuf](htt But as always, make your own choice based on your requirements. +## Adding New Serializers + +Review the following instructions _before_ opening the PR to add a new +serializer: + +- Create all the required serializer code in `internal/`. +- Add an entry to the serializer in [benchmarks.go](benchmarks.go). +- If the serializer supports both reusing/not reusing its marshalling buffer: + - Add both a `serializer` and `serializer/reuse` entries, each one + respectively reusing/not reusing the resulting marshalling buffer. Set the + `BufferReuseMarshal` flag accordingly. +- If the serializer supports both safe and unsafe string unmarshalling: + - Add both a `serializer` and `serializer/unsafe` entries, each one + respectively unmarshalling into safe and unsafe strings. Set the + `UnsafeStringUnmarshal` flag accordingly. +- If the serializer supports both marshalling buffer reuse and unsafe string + unmarshalling, merge both options into a single `serializer/unsafe_reuse` + entry (check the baseline serializer for an example). +- Regenerate the report by running: + +``` +go test -tags genreport -run TestGenerateReport +``` + +- **Include the updated report data in your PR** + ## Data The data being serialized is the following structure with randomly generated values: