-
Notifications
You must be signed in to change notification settings - Fork 11
Comparing changes
Open a pull request
base repository: hashicorp/go-set
base: v0.1.9
head repository: hashicorp/go-set
compare: v0.1.10
- 5 commits
- 13 files changed
- 3 contributors
Commits on Mar 8, 2023
-
[COMPLIANCE] Add Copyright and License Headers (#31)
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for e41db0c - Browse repository at this point
Copy the full SHA e41db0cView commit details -
build(deps): bump github.com/shoenig/test from 0.6.1 to 0.6.2 (#32)
Bumps [github.com/shoenig/test](https://github.com/shoenig/test) from 0.6.1 to 0.6.2. - [Release notes](https://github.com/shoenig/test/releases) - [Commits](shoenig/test@v0.6.1...v0.6.2) --- updated-dependencies: - dependency-name: github.com/shoenig/test dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 87073d0 - Browse repository at this point
Copy the full SHA 87073d0View commit details
Commits on Mar 17, 2023
-
sets: rename All funcs as Slice funcs (#30)
This PR renames InsertAll() and RemoveAll() as InsertSlice() and RemoveSlice() to be more clear and consistent with other things.
Configuration menu - View commit details
-
Copy full SHA for 200d9e1 - Browse repository at this point
Copy the full SHA 200d9e1View commit details
Commits on Apr 3, 2023
-
sets: add TreeSet type for orderable data (#33)
This PR adds TreeSet to the implemented set types. A TreeSet has advantages in cases where the data being stored can be represented in some kind of order. Order-specific operations such as finding the minimum value of a set, finding the TopK or BottomK elements of a set, or iterating the elements of a set in order are dramatically less expensive when stored via binary search tree. A TreeSet[T] determines order between its elements via Compare[T], where the implementation of Compare is provided by the user. The Cmp[BuiltIn] helper provides a convenience implementation of Compare for built-in types. The TreeSet type is backed by an underlying Red-Black Binary Search Tree[0], a well established data structure found in major projects such as the Linux Kernel and Java Virtual Machine. Benchmarks are provided below for comparing some operations across the different set types, including plain slices. The following table describes the expected asymptotic performance for some operations of each type. | | slice | Set | HashSet | TreeSet | | :-- | :-- | :-- | :-- | :-- | | Insert (avg) | O(1) | O(1) | O(1) | O(log(n)) | | Insert (worst) | O(n) | O(n) | O(n) | O(log(n)) | | Delete (avg) | O(n) | O(1) | O(1) | O(log(n)) | | Delete (worst) | O(n) | O(n) | O(n) | O(log(n)) | | Contains | O(n) | O(1) | O(1) | O(log(n)) | | Min | O(n) | O(n) | O(n) | O(log(n)) | | TopK | O(n * log(n)) | O(n * log(n)) | O(n * log(n)) | O(log(n)) | | Iterate | O(n) | O(n) | O(n) | O(n) | | Iterate (in order) | O(n * log(n)) | O(n * log(n)) | O(n * log(n)) | O(n) | [0] https://en.wikipedia.org/wiki/Red–black_tree Benchmark_Slice_Insert/10-12 283483903 3.538 ns/op Benchmark_Slice_Insert/1000-12 554723365 3.249 ns/op Benchmark_Slice_Insert/100000-12 626779956 2.414 ns/op Benchmark_Slice_Insert/1000000-12 615125025 3.122 ns/op Benchmark_Set_Insert/10-12 19020508 117.2 ns/op Benchmark_Set_Insert/1000-12 19318110 117.0 ns/op Benchmark_Set_Insert/100000-12 18946682 116.8 ns/op Benchmark_Set_Insert/1000000-12 13727908 125.4 ns/op Benchmark_HashSet_Insert/10-12 14467316 139.3 ns/op Benchmark_HashSet_Insert/1000-12 15396433 140.8 ns/op Benchmark_HashSet_Insert/100000-12 14508603 138.8 ns/op Benchmark_HashSet_Insert/1000000-12 10585650 119.0 ns/op Benchmark_TreeSet_Insert/10-12 10633179 120.7 ns/op Benchmark_TreeSet_Insert/1000-12 10658127 122.1 ns/op Benchmark_TreeSet_Insert/100000-12 10504867 126.2 ns/op Benchmark_TreeSet_Insert/1000000-12 10902920 125.9 ns/op Benchmark_Slice_Minimum/10-12 12310653 96.23 ns/op Benchmark_Slice_Minimum/1000-12 144500 8181 ns/op Benchmark_Slice_Minimum/100000-12 1434 819509 ns/op Benchmark_Slice_Minimum/1000000-12 134 8655484 ns/op Benchmark_Set_Minimum/10-12 5023794 235.9 ns/op Benchmark_Set_Minimum/1000-12 18967 63799 ns/op Benchmark_Set_Minimum/100000-12 124 9530887 ns/op Benchmark_Set_Minimum/1000000-12 9 112611542 ns/op Benchmark_HashSet_Minimum/10-12 4418487 269.0 ns/op Benchmark_HashSet_Minimum/1000-12 19364 61636 ns/op Benchmark_HashSet_Minimum/100000-12 128 9290069 ns/op Benchmark_HashSet_Minimum/1000000-12 10 110000279 ns/op Benchmark_TreeSet_Minimum/10-12 591382812 2.018 ns/op Benchmark_TreeSet_Minimum/1000-12 298672525 4.021 ns/op Benchmark_TreeSet_Minimum/100000-12 208646332 5.738 ns/op Benchmark_TreeSet_Minimum/1000000-12 181639167 6.598 ns/op Benchmark_Slice_Contains/10-12 246240872 4.866 ns/op Benchmark_Slice_Contains/1000-12 3896030 305.8 ns/op Benchmark_Slice_Contains/100000-12 41647 28732 ns/op Benchmark_Slice_Contains/1000000-12 4068 288287 ns/op Benchmark_Set_Contains/10-12 190191267 6.304 ns/op Benchmark_Set_Contains/1000-12 183063370 6.526 ns/op Benchmark_Set_Contains/100000-12 127484904 9.357 ns/op Benchmark_Set_Contains/1000000-12 82559810 12.68 ns/op Benchmark_HashSetContains/10-12 173321290 6.877 ns/op Benchmark_HashSetContains/1000-12 166393195 7.205 ns/op Benchmark_HashSetContains/100000-12 120025850 9.974 ns/op Benchmark_HashSetContains/1000000-12 40584700 26.22 ns/op Benchmark_TreeSetContains/10-12 167040844 7.163 ns/op Benchmark_TreeSetContains/1000-12 51727203 22.68 ns/op Benchmark_TreeSetContains/100000-12 42277028 27.81 ns/op Benchmark_TreeSetContains/1000000-12 29599938 40.17 ns/op
Configuration menu - View commit details
-
Copy full SHA for 579403b - Browse repository at this point
Copy the full SHA 579403bView commit details -
build(deps): bump github.com/shoenig/test from 0.6.2 to 0.6.3 (#34)
Bumps [github.com/shoenig/test](https://github.com/shoenig/test) from 0.6.2 to 0.6.3. - [Release notes](https://github.com/shoenig/test/releases) - [Commits](shoenig/test@v0.6.2...v0.6.3) --- updated-dependencies: - dependency-name: github.com/shoenig/test dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for aeaec54 - Browse repository at this point
Copy the full SHA aeaec54View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff v0.1.9...v0.1.10