-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
json: configurable numeric decoding (#137)
* json: stylistic improvements, better code reuse Initial benchmark results show this change to be approximately performance-neutral. * bump tested Go versions to just 1.20 and 1.21 * json: add ParseFlags values UseInt64, UseUint64, UseBigInt * json: use atomic.Pointer
- Loading branch information
1 parent
6dfc1b0
commit 3055897
Showing
13 changed files
with
334 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,63 @@ | ||
--- | ||
name: Benchmark | ||
|
||
on: | ||
- pull_request | ||
"on": | ||
- pull_request | ||
|
||
jobs: | ||
benchmark: | ||
strategy: | ||
matrix: | ||
ref: | ||
- master | ||
- ${{ github.sha }} | ||
- master | ||
- ${{ github.sha }} | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Steup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ matrix.ref }} | ||
|
||
- name: Run Benchmarks | ||
run: go test -v -run '^$' -bench '(Marshal|Unmarshal)$/codeResponse' -benchmem -benchtime 3s -cpu 1 -count 5 ./json | tee bench.txt | ||
|
||
- name: Upload Benchmarks | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ matrix.ref }} | ||
path: bench.txt | ||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1.21" | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ matrix.ref }} | ||
|
||
- name: Run Benchmarks | ||
# Without 6 iterations, benchstat will claim statistical insignificance. | ||
run: go test -v -run '^$' -bench '(Marshal|Unmarshal)$/codeResponse' -benchmem -benchtime 3s -cpu 1 -count 6 ./json | tee bench.txt | ||
|
||
- name: Upload Benchmarks | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ matrix.ref }} | ||
path: bench.txt | ||
|
||
benchstat: | ||
needs: [benchmark] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Steup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17 | ||
|
||
- name: Setup Benchstat | ||
run: go install golang.org/x/perf/cmd/benchstat@latest | ||
|
||
- name: Download Benchmark Results | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: . | ||
|
||
- name: Run Benchstat | ||
run: benchstat ./master/bench.txt ./${{ github.sha }}/bench.txt | tee benchstat.txt | ||
|
||
- name: Upload Benchstat Results | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: benchstat | ||
path: benchstat.txt | ||
- name: Steup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1.21" | ||
|
||
- name: Setup Benchstat | ||
run: go install golang.org/x/perf/cmd/benchstat@latest | ||
|
||
- name: Download Benchmark Results | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: . | ||
|
||
- name: Run Benchstat | ||
run: benchstat ./master/bench.txt ./${{ github.sha }}/bench.txt | tee benchstat.txt | ||
|
||
- name: Upload Benchstat Results | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: benchstat | ||
path: benchstat.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,29 @@ | ||
--- | ||
name: Test | ||
|
||
on: | ||
- pull_request | ||
"on": | ||
- pull_request | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
go: | ||
- 1.14 | ||
- 1.15 | ||
- 1.16 | ||
- 1.17 | ||
- "1.20" | ||
- "1.21" | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup Go ${{ matrix.go }} | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
- name: Setup Go ${{ matrix.go }} | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
|
||
- name: Download Dependencies | ||
run: go mod download | ||
- name: Download Dependencies | ||
run: go mod download | ||
|
||
- name: Run Tests | ||
run: make test | ||
- name: Run Tests | ||
run: make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
module github.com/segmentio/encoding | ||
|
||
go 1.14 | ||
go 1.18 | ||
|
||
require github.com/segmentio/asm v1.1.3 | ||
|
||
require golang.org/x/sys v0.0.0-20211110154304-99a53858aa08 // indirect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.