-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start the sorting rewrite of matrix for performance
Signed-off-by: Ryan Cragun <[email protected]>
- Loading branch information
1 parent
330abd1
commit 7f44772
Showing
11 changed files
with
946 additions
and
1,037 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
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,25 @@ | ||
package flightplan | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
var benchmarkMatrix = &Matrix{Vectors: []*Vector{ | ||
NewVector(NewElement("arch", "amd64"), NewElement("arch", "arm64")), | ||
NewVector(NewElement("backend", "consul"), NewElement("backend", "raft")), | ||
NewVector(NewElement("source", "local"), NewElement("source", "crt"), NewElement("source", "art")), | ||
NewVector(NewElement("type", "bundle"), NewElement("source", "package")), | ||
NewVector(NewElement("backend_ver", "1.14.2"), NewElement("backend_ver", "1.13.2"), NewElement("backend_ver", "1.12.2"), NewElement("backend_ver", "1.11.2")), | ||
NewVector(NewElement("distro", "rhel"), NewElement("distro", "ubuntu")), | ||
NewVector(NewElement("edition", "ce"), NewElement("edition", "ent"), NewElement("edition", "ent.hms"), NewElement("edition", "ent.fips1402"), NewElement("edition", "ent.hsm.fips1402")), | ||
NewVector(NewElement("seal", "shamir"), NewElement("awskms", "awkms")), | ||
}} | ||
|
||
func Benchmark_Matrix_UniqueValues(b *testing.B) { | ||
b.Run("UniqueValuesNew", func(b *testing.B) { | ||
benchmarkMatrix.Copy().CartesianProduct().UniqueValues() | ||
}) | ||
b.Run("UniqueValuesOld", func(b *testing.B) { | ||
benchmarkMatrix.Copy().CartesianProduct().UniqueValuesOld() | ||
Check failure on line 23 in internal/flightplan/matrix_benchmark_test.go GitHub Actions / Validate Artifact / Lint
|
||
}) | ||
} |
Oops, something went wrong.