Skip to content

Commit

Permalink
readme: Update with new serializer instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusd committed Jun 19, 2024
1 parent 763247e commit 166f7e3
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,46 @@ 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
important factors [JSON](http://golang.org/pkg/encoding/json/) or [Protobuf](https://google.golang.org/protobuf) are your best options.

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/<short serializer name>`.
- 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:
Expand Down

0 comments on commit 166f7e3

Please sign in to comment.