1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-10 07:42:27 +08:00

perf(slice): make the IndexOf function thread-safe (#263)

This commit is contained in:
残念
2024-11-06 10:04:44 +08:00
committed by GitHub
parent 8bbae69175
commit a7fecfc73b
3 changed files with 64 additions and 6 deletions

View File

@@ -149,7 +149,7 @@ func FilterConcurrent[T any](slice []T, predicate func(index int, item T) bool,
return result
}
// UniqueByParallel removes duplicate elements from the slice by parallel
// UniqueByConcurrent removes duplicate elements from the slice by parallel
// The comparator function is used to compare the elements
// The numThreads parameter specifies the number of threads to use
// If numThreads is less than or equal to 0, it will be set to 1