-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Map key sorting could be improved #1
Labels
Comments
slimsag
added
enhancement
New feature or request
help wanted
Extra attention is needed
labels
Dec 30, 2020
slimsag
added a commit
that referenced
this issue
Dec 30, 2020
Creates issue #1 Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
slimsag
added a commit
that referenced
this issue
Feb 18, 2021
With complex data types, this can provide a 66% performance improvement. Before: ``` $ go test -bench=. goos: darwin goarch: amd64 pkg: github.com/hexops/valast BenchmarkComplexType-16 2 564812395 ns/op PASS ok github.com/hexops/valast 9.372s ``` After: ``` $ go test -bench=. goos: darwin goarch: amd64 pkg: github.com/hexops/valast BenchmarkComplexType-16 6 189646854 ns/op PASS ok github.com/hexops/valast 6.379s ``` In practice this can result in tests running much faster, before: ``` --- PASS: TestUnionMerge (6.38s) --- PASS: TestUnionMerge/#00 (1.42s) --- PASS: TestUnionMerge/#1 (1.17s) --- PASS: TestUnionMerge/#2 (2.32s) --- PASS: TestUnionMerge/#3 (0.00s) --- PASS: TestUnionMerge/#4 (0.00s) --- PASS: TestUnionMerge/#5 (1.46s) ``` After: ``` --- PASS: TestUnionMerge (2.96s) --- PASS: TestUnionMerge/#00 (1.05s) --- PASS: TestUnionMerge/#1 (0.77s) --- PASS: TestUnionMerge/#2 (0.77s) --- PASS: TestUnionMerge/#3 (0.00s) --- PASS: TestUnionMerge/#4 (0.00s) --- PASS: TestUnionMerge/#5 (0.37s) ``` Also appears to fix hexops/autogold#16 Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
slimsag
added a commit
that referenced
this issue
Feb 18, 2021
With complex data types, this can provide a 66% performance improvement. Before: ``` $ go test -bench=. goos: darwin goarch: amd64 pkg: github.com/hexops/valast BenchmarkComplexType-16 2 564812395 ns/op PASS ok github.com/hexops/valast 9.372s ``` After: ``` $ go test -bench=. goos: darwin goarch: amd64 pkg: github.com/hexops/valast BenchmarkComplexType-16 6 189646854 ns/op PASS ok github.com/hexops/valast 6.379s ``` In practice this can result in tests running much faster, before: ``` --- PASS: TestUnionMerge (6.38s) --- PASS: TestUnionMerge/#00 (1.42s) --- PASS: TestUnionMerge/#1 (1.17s) --- PASS: TestUnionMerge/#2 (2.32s) --- PASS: TestUnionMerge/#3 (0.00s) --- PASS: TestUnionMerge/#4 (0.00s) --- PASS: TestUnionMerge/#5 (1.46s) ``` After: ``` --- PASS: TestUnionMerge (2.96s) --- PASS: TestUnionMerge/#00 (1.05s) --- PASS: TestUnionMerge/#1 (0.77s) --- PASS: TestUnionMerge/#2 (0.77s) --- PASS: TestUnionMerge/#3 (0.00s) --- PASS: TestUnionMerge/#4 (0.00s) --- PASS: TestUnionMerge/#5 (0.37s) ``` Also appears to fix hexops/autogold#16 Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Map keys are sorted according to regular Go rules, but a number of Go values cannot be sorted according to those rules. As it stands, valast will produce unstable output in such situations.
It would be nice to find a better way to resolve this. Feedback on how to handle this very welcome.
The text was updated successfully, but these errors were encountered: