-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: various performance improvements for all options
Replace calls to reflect.DeepEqual with a custom comparison function that only operates on the types used by encoding/json. Replace calls to json.Marshal, used to calculate the length of patch operations when using the Rationalize option, with a custom Operation method that lookup the size of the value from the original target bytes. name old time/op new time/op delta Compare/differ_diff/default-8 6.96µs ± 0% 5.21µs ± 1% -25.11% Compare/differ_diff/invertible-8 7.80µs ± 0% 6.02µs ± 0% -22.87% Compare/differ_diff/factorize-8 11.4µs ± 1% 7.5µs ± 0% -33.73% Compare/differ_diff/rationalize-8 59.8µs ± 0% 30.6µs ± 1% -48.77% Compare/differ_diff/factor+ratio-8 63.8µs ± 1% 29.8µs ± 0% -53.19% Compare/differ_diff/all-options-8 89.3µs ± 0% 37.4µs ± 1% -58.16% name old alloc/op new alloc/op delta Compare/differ_diff/default-8 3.25kB ± 0% 3.28kB ± 0% +0.99% Compare/differ_diff/invertible-8 5.94kB ± 0% 5.97kB ± 0% +0.54% Compare/differ_diff/factorize-8 3.80kB ± 0% 3.85kB ± 0% +1.26% Compare/differ_diff/rationalize-8 16.3kB ± 0% 5.9kB ± 0% -63.98% Compare/differ_diff/factor+ratio-8 16.8kB ± 0% 6.3kB ± 0% -62.57% Compare/differ_diff/all-options-8 24.7kB ± 0% 7.8kB ± 0% -68.68% name old allocs/op new allocs/op delta Compare/differ_diff/default-8 32.0 ± 0% 32.0 ± 0% ~ Compare/differ_diff/invertible-8 33.0 ± 0% 33.0 ± 0% ~ Compare/differ_diff/factorize-8 53.0 ± 0% 47.0 ± 0% -11.32% Compare/differ_diff/rationalize-8 232 ± 0% 91 ± 0% -60.78% Compare/differ_diff/factor+ratio-8 253 ± 0% 102 ± 0% -59.68% Compare/differ_diff/all-options-8 348 ± 0% 108 ± 0% -68.97%
- Loading branch information
Showing
18 changed files
with
387 additions
and
88 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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
run: | ||
timeout: 10m | ||
linters: | ||
disable-all: true | ||
enable: | ||
- asciicheck | ||
- bodyclose | ||
- deadcode | ||
- depguard | ||
- dogsled | ||
- dupl | ||
- errcheck | ||
- exportloopref | ||
- funlen | ||
- gocognit | ||
- goconst | ||
- gocritic | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- misspell | ||
- nakedret | ||
- nolintlint | ||
- revive | ||
- rowserrcheck | ||
- staticcheck | ||
- structcheck | ||
- stylecheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- varcheck | ||
- whitespace | ||
linters-settings: | ||
gofmt: | ||
simplify: true | ||
dupl: | ||
threshold: 400 | ||
funlen: | ||
lines: 120 |
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,6 +1,6 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 William Poussier <[email protected]> | ||
Copyright (c) 2020-2022 William Poussier <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
SOFTWARE. |
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
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
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.