Commit Graph

781 Commits

Author SHA1 Message Date
Samuel Berthe ac8295b68a style(simd): rename sse to avx (#821)
* style(simd): rename sse to avx

* fix(exp,simd): apply the right avx512 constraints to a few methods

* fix(exp,simd): apply the right avx512 constraints to a few methods
2026-02-26 22:08:53 +01:00
d-enk c49f84658a perf: lazy it.Reverse iteration instead of in-place mutation (#814)
Replace mutable.Reverse() with lazy iteration from end.
This avoids unnecessary array mutation and reduces overhead.
2026-02-25 20:59:44 +01:00
d-enk b9c84bc078 perf: optimize Zip and ZipBy functions (#818)
- Replace Nth() with NthOrEmpty() to avoid unnecessary error allocation on miss
- Change make(0, size) + append to make(size) + direct assignment
- Use uint for loop indices
- Remove temporary variables in ZipBy functions

This reduces overhead from append operations and structure creation,
similar to the Zip5Copy2 optimization pattern.

Reduces code size: +174/-242 lines
2026-02-25 20:57:04 +01:00
d-enk b27b00635d perf: avoid unnecessary error allocation in NthOr, NthOrEmpty (#817)
Extract core logic into sliceNth/seqNth func returning (T, bool) instead of (T, error).

NthOr and NthOrEmpty now use these directly,
avoiding fmt.Errorf allocation when nth is out of bounds.
2026-02-25 20:50:51 +01:00
d-enk b0b5cc3adf perf: preallocate result slice in RangeWithSteps (#820)
- RangeWithSteps now preallocates result slice using math.Ceil for better performance
- Fix edge cases for floating point values with small steps
- Add test cases for float and custom type validation
- Rename TestRangeClose → TestRangeWithSteps for consistency
- Simplify ChunkEntries chunk count calculation using ((count-1)/size)+1 formula
2026-02-25 20:48:26 +01:00
Samuel Berthe 41cfa4c55a chore(ci): use last go version with codeql 2026-02-25 20:25:36 +01:00
Samuel Berthe 84beb70d2e oops 2026-02-25 19:08:19 +01:00
Samuel Berthe 2554fc697a chore(ci): adding codeql (#819) 2026-02-25 19:05:32 +01:00
d-enk d0901349e7 perf: optimize it.ContainsBy, EveryBy, SomeBy, NoneBy to avoid unnecessary allocations (#812)
Replace intermediate iterator chains with direct loops and early returns.

The direct loops with early return eliminate intermediate iterator
creation from Filter(), Reject(), IsNotEmpty() and IsEmpty() functions.

Benchmark results (benchstat):
                         │    old.txt    │               new.txt               │
                         │    sec/op     │    sec/op     vs base               │
ItContainsBy/ints_10-4      807.2n ± 54%   151.0n ±  6%  -81.29% (p=0.000 n=8)
ItContainsBy/ints_100-4     2.447µ ± 14%   1.531µ ± 11%  -37.42% (p=0.000 n=8)
ItContainsBy/ints_1000-4    17.67µ ±  4%   13.85µ ±  4%  -21.64% (p=0.000 n=8)
ItEveryBy/ints_10-4        1022.5n ± 63%   208.0n ± 34%  -79.66% (p=0.000 n=8)
ItEveryBy/ints_100-4        5.640µ ± 36%   1.542µ ±  9%  -72.67% (p=0.000 n=8)
ItEveryBy/ints_1000-4       52.22µ ± 54%   19.29µ ± 16%  -63.06% (p=0.000 n=8)
ItSomeBy/ints_10-4         2227.5n ± 43%   187.1n ± 14%  -91.60% (p=0.000 n=8)
ItSomeBy/ints_100-4         4.611µ ± 22%   1.691µ ± 10%  -63.32% (p=0.000 n=8)
ItSomeBy/ints_1000-4        39.41µ ± 27%   22.61µ ± 24%  -42.63% (p=0.000 n=8)
ItNoneBy/ints_10-4         1657.5n ± 34%   196.3n ± 21%  -88.15% (p=0.000 n=8)
ItNoneBy/ints_100-4         4.503µ ± 20%   1.743µ ± 12%  -61.30% (p=0.000 n=8)
ItNoneBy/ints_1000-4        29.39µ ± 29%   16.66µ ± 15%  -43.32% (p=0.000 n=8)
geomean                     5.591µ         1.747µ        -68.76%

                         │  old.txt   │               new.txt                │
                         │    B/op    │   B/op    vs base                    │
ItContainsBy/ints_10-4     200.0 ± 0%   0.0 ± 0%  -100.00% (p=0.000 n=8)
ItContainsBy/ints_100-4    200.0 ± 0%   0.0 ± 0%  -100.00% (p=0.000 n=8)
ItContainsBy/ints_1000-4   200.0 ± 0%   0.0 ± 0%  -100.00% (p=0.000 n=8)
ItEveryBy/ints_10-4        184.0 ± 0%   0.0 ± 0%  -100.00% (p=0.000 n=8)
ItEveryBy/ints_100-4       184.0 ± 0%   0.0 ± 0%  -100.00% (p=0.000 n=8)
ItEveryBy/ints_1000-4      184.0 ± 0%   0.0 ± 0%  -100.00% (p=0.000 n=8)
ItSomeBy/ints_10-4         200.0 ± 0%   0.0 ± 0%  -100.00% (p=0.000 n=8)
ItSomeBy/ints_100-4        200.0 ± 0%   0.0 ± 0%  -100.00% (p=0.000 n=8)
ItSomeBy/ints_1000-4       200.0 ± 0%   0.0 ± 0%  -100.00% (p=0.000 n=8)
ItNoneBy/ints_10-4         200.0 ± 0%   0.0 ± 0%  -100.00% (p=0.000 n=8)
ItNoneBy/ints_100-4        200.0 ± 0%   0.0 ± 0%  -100.00% (p=0.000 n=8)
ItNoneBy/ints_1000-4       200.0 ± 0%   0.0 ± 0%  -100.00% (p=0.000 n=8)

                         │  old.txt   │                new.txt                 │
                         │ allocs/op  │ allocs/op   vs base                    │
ItContainsBy/ints_10-4     7.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=8)
ItContainsBy/ints_100-4    7.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=8)
ItContainsBy/ints_1000-4   7.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=8)
ItEveryBy/ints_10-4        6.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=8)
ItEveryBy/ints_100-4       6.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=8)
ItEveryBy/ints_1000-4      6.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=8)
ItSomeBy/ints_10-4         7.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=8)
ItSomeBy/ints_100-4        7.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=8)
ItSomeBy/ints_1000-4       7.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=8)
ItNoneBy/ints_10-4         7.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=8)
ItNoneBy/ints_100-4        7.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=8)
ItNoneBy/ints_1000-4       7.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=8)

Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2026-02-24 20:26:59 +01:00
d-enk b33df06020 perf: optimize it.Find to avoid unnecessary allocations (#811)
Replace First(Filter(collection, predicate)) with direct loop implementation.

The direct loop with early return eliminates intermediate iterator
creation from Filter() and First() functions.

Benchmark results:
                   │   old.txt    │               new.txt               │
                   │    sec/op    │    sec/op     vs base               │
ItFind/ints_10-4     521.3n ± 14%   157.3n ±  8%  -69.82% (p=0.000 n=8)
ItFind/ints_100-4    1.913µ ± 13%   1.545µ ± 22%  -19.26% (p=0.002 n=8)
ItFind/ints_1000-4   17.07µ ±  7%   12.88µ ±  1%  -24.59% (p=0.000 n=8)
geomean              2.573µ         1.462µ        -43.15%

                   │  old.txt   │               new.txt                │
                   │    B/op    │   B/op    vs base                    │
ItFind/ints_10-4     192.0 ± 0%   0.0 ± 0%  -100.00% (p=0.000 n=8)
ItFind/ints_100-4    192.0 ± 0%   0.0 ± 0%  -100.00% (p=0.000 n=8)
ItFind/ints_1000-4   192.0 ± 0%   0.0 ± 0%  -100.00% (p=0.000 n=8)

                   │  old.txt   │                new.txt                 │
                   │ allocs/op  │ allocs/op   vs base                    │
ItFind/ints_10-4     7.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=8)
ItFind/ints_100-4    7.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=8)
ItFind/ints_1000-4   7.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=8)

Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2026-02-24 20:25:28 +01:00
d-enk fc6b369dd2 perf: optimize it.CountBy by removing Filter iterator chain (#813)
- Remove unnecessary Filter(collection, predicate) chain
- Use direct loop with predicate check instead
- Results: -36.68% time geomean, -100% B/op, -100% allocs/op

Benchstat results:
                      │   old.txt    │              new.txt               │
                      │    sec/op    │   sec/op     vs base               │
ItCountBy/ints_10-4     433.0n ± 23%   186.2n ± 5%  -56.99% (p=0.000 n=8)
ItCountBy/ints_100-4    2.487µ ± 27%   1.678µ ± 6%  -32.55% (p=0.000 n=8)
ItCountBy/ints_1000-4   20.16µ ±  8%   17.64µ ± 4%  -12.50% (p=0.005 n=8)
geomean                 2.790µ         1.766µ       -36.68%

                      │  old.txt   │               new.txt                │
                      │    B/op    │   B/op    vs base                    │
ItCountBy/ints_10-4     160.0 ± 0%   0.0 ± 0%  -100.00% (p=0.000 n=8)
ItCountBy/ints_100-4    160.0 ± 0%   0.0 ± 0%  -100.00% (p=0.000 n=8)
ItCountBy/ints_1000-4   160.0 ± 0%   0.0 ± 0%  -100.00% (p=0.000 n=8)

                      │  old.txt   │                new.txt                 │
                      │ allocs/op  │ allocs/op   vs base                    │
ItCountBy/ints_10-4     6.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=8)
ItCountBy/ints_100-4    6.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=8)
ItCountBy/ints_1000-4   6.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=8)
2026-02-24 20:23:49 +01:00
d-enk ad6297335b refactor: remove redundant map zero value initialization in throttleBy (#815)
Remove unnecessary existence check and zero value assignment.
Go maps return zero value for missing keys, making this redundant.
2026-02-24 20:22:52 +01:00
d-enk 6b8eea7994 refactor: use separate variables for each iter.Pull in it.Zip functions (#816)
Replace shared next struct and reused stop variable with separate
nextA, stopA, nextB, stopB, etc.

Improves code clarity and eliminates potential confusion from variable reuse.
2026-02-24 20:21:56 +01:00
Yuliya c1d11cb658 Add iterator slice helpers (#791)
* add iterator slice helpers and channel dedup/tee

* note unbounded memory growth in Distinct; simplify Take

* avoid extra iteration in Take/TakeWhile/TakeFilter and precompute Sliding step

* avoid reallocations in Sliding overlap shift

* sliding uses ring buffer

* refactor Sliding and expand TestSliding

* Remove Tee; add TakeFilter variant, rewrite Sliding

* remove channel Distinct/DistinctBy

* TakeFilter/TakeFilterI for slice

* Revert "TakeFilter/TakeFilterI for slice"

This reverts commit 6d2fcdc07b.

* doc  add new helpers to llms.txt

---------

Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2026-02-23 20:27:51 +01:00
Samuel Berthe 921fb61893 refactor: remove helpers deprecated for more than 3y 2026-02-22 05:20:42 +01:00
Samuel Berthe 86e5d8b15d refactor: remove helpers deprecated for more than 3y (#810) 2026-02-22 05:14:28 +01:00
d-enk c70160efcd fix: correct DropByIndex handling of negative indices out of bounds (#778)
Fixed DropByIndex function for the case when a negative index exceeds
the slice size. This caused subsequent indices to have incorrect
offsets, leading to incorrect results.

Example of the bug:
  DropByIndex([]int{0, 1, 2, 3, 4}, -100, 4)
  returned []int{0, 1, 2, 4} instead of []int{0, 1, 2, 3}

Improvements:
- Removed map-based uniqueness check, now uses sorted iteration with O(1) memory
- Added copy of indexes to prevent mutation of input
- Fixed negative index handling logic
- Improved range check using uint for proper bounds validation

Performance:
- Time: -75.61% (geomean)
- Memory: -62.65% (geomean)
- Allocations: -43.67% (geomean)

Additional:
- Optimized Filter and FilterI in mutable/slice.go
2026-02-22 04:27:07 +01:00
Samuel Berthe a602a36075 test: adding missing test cases to ellipsis (#809) 2026-02-21 22:56:05 +01:00
Samuel Berthe 105f9555f0 doc(exp,simd): adding warning about API stability for code under exp/ (#808) 2026-02-21 19:49:03 +01:00
Samuel Berthe f3dabcacf7 oops 2026-02-21 19:33:50 +01:00
Samuel Berthe 7f2504a902 💄 2026-02-21 19:32:45 +01:00
Varun Chawla 0b4623da1e fix: make Ellipsis operate on runes instead of bytes to prevent Unicode truncation (#796)
* fix: make Ellipsis operate on runes instead of bytes to prevent Unicode truncation

The Ellipsis function previously used byte-based length counting (len(str))
and byte-based slicing (str[:length-3]), which could split multi-byte
Unicode characters in the middle, producing garbled output.

This changes the function to use []rune conversion so the length parameter
counts Unicode code points instead of bytes. Emoji, CJK ideographs, and
other multi-byte characters are now never split in the middle.

Fixes #520

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: avoid rune slice allocation in Ellipsis

Use range-based iteration to count runes without allocating a []rune
slice, per reviewer suggestion. The early-return for length < 3 is
kept explicit for clarity.

* Simplify Ellipsis: remove early return for length < 3, reuse ellipsis const

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 19:29:10 +01:00
Tolochik Igor Vladimirovich 48d6af1394 fix: reset n counter per iteration in it.Replace (#799) 2026-02-21 19:24:13 +01:00
Samuel Berthe 035f1b358a Experiments: adding SIMD helpers (#801)
* feat(exp,simd): adding SumAxB helpers

* feat(exp,simd): adding MeanAxB and ClampAxB helpers

* feat(exp,simd): adding MinAxB and MaxAxB helpers

* refactor(exp,simd): group perf helper category + architecture

* feat(exp,simd): adding ContainsAxB helpers

* perf(exp,simd): cast to unsafe slice once

* feat(exp,simd): call the right SIMD helper based on local architecture

* chore: internal dependency linking

* Update exp/simd/math.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* style: fix linter

* style: fix linter

* chore: enable simd in makefile

* chore(ci): add simd package to test runs

* chore(ci): add simd package to test runs only for go 1.26

* fix(simd): fix overflow

* fix(simd): fix overflow and apply the same behavior than lo.Mean

* doc(exp,simd): adding initial doc

* refactor(simd): move intersect_avx2 and intersect_sse code into intersect_avx512

* fix(simd): call SSE fallback instead of lo.Sum for default helpers

* feat(simd): cache simd features on package init to avoid repeated checks

* perf(exp,simd): precompute length + improve code quality

* perf(exp,simd): faster iteration for min/max value

* test(exp,simd): adding benchmarks

* test(exp,simd): adding benchmarks results

* test(exp,simd): adding benchmarks results

* doc(exp,simd): adding warning for overflows in SIMD operations

* feat(exp,simd): adding more dispatch helpers

* feat(exp,simd): adding SumBy variants

* feat(exp,simd): adding MeanBy variants

* fix(exp,simd): faster clamp

* 💄

* doc(exp,simd): adding SumBy + MeanBy

* fix(exp,simd): faster SIMD operations

* chore(ci): enable the benchmarks temporary

* chore(ci): display cpu architecture before running tests

* chore(ci): github actions are hidding some useful stuffs

* chore(ci): no SIMD VM available at Github during the weekend ???

* test(exp,simd): larger epsilon

* oops

* perf(exp,simd): faster iterations

* doc(exp,simd): report last version of benchmarks

* 💄

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-21 19:19:36 +01:00
dependabot[bot] 7f11642b95 chore(deps): bump ajv from 6.12.6 to 6.14.0 in /docs (#807)
Bumps [ajv](https://github.com/ajv-validator/ajv) from 6.12.6 to 6.14.0.
- [Release notes](https://github.com/ajv-validator/ajv/releases)
- [Commits](https://github.com/ajv-validator/ajv/compare/v6.12.6...v6.14.0)

---
updated-dependencies:
- dependency-name: ajv
  dependency-version: 6.14.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-21 17:56:06 +01:00
Samuel Berthe 3e269f8f39 chore(ci): improve go version management in CI (#806)
* chore(ci): improve go version management in CI

* oops

* oops

* chore(ci): skip some triggers
2026-02-21 17:39:00 +01:00
Samuel Berthe 7cb99dfc9f doc: adblockers broke my sponsorship program ¯\_(ツ)_/¯ 2026-02-19 16:57:19 +01:00
Samuel Berthe 8f6fed125a doc: adding sponsor (DBOS) ✌️ 2026-02-19 16:30:24 +01:00
Samuel Berthe cbdb302c7e Added sponsorship
Added sponsorship section to README with DBOS details.
2026-02-19 15:57:21 +01:00
Samuel Berthe 34e2ec595d style: fix linter (#802) 2026-02-16 15:42:42 +01:00
d-enk d269b33e8c perf: replace Min/Max(Range) with Min/MaxIndexBy in DispatchingStrategy (#779)
- Replace Range+MinBy with MinIndexBy in DispatchingStrategyLeast for better performance
- Replace Range+MaxBy with MaxIndexBy in DispatchingStrategyMost for better performance
- Use range loop in DispatchingStrategyWeightedRandom for better readability
- Simplify Buffer function by using local variable in for loop and returning size directly

These changes reduce allocations and improve performance by using more efficient
index-finding functions instead of creating intermediate slices with Range().
2026-02-08 02:38:15 +01:00
d-enk a822176cba perf: optimize it.Trim to use DropLastWhile(DropWhile(...)) (#780)
Change Trim to use DropLastWhile(DropWhile(...)) instead of DropWhile(DropLastWhile(...))

This is more efficient because DropWhile doesn't use a buffer, so it removes
leading elements first, then DropLastWhile works with a smaller collection.
2026-02-08 02:35:49 +01:00
d-enk 73a8fc6255 refactor: improve SamplesBy performance and revert non-panic behavior for negative count (#786)
Regression introduced in 1c66270 (perf: preallocate result slice in SamplesBy) where
`make(Slice, count)` with negative count causes panic. Previously used
`Slice{}` with `append`, which handled negative counts gracefully.

- Simplify NthOrEmpty by removing redundant error handling
- Simplify Sample by removing intermediate variable
- Refactor SamplesBy to use index tracking instead of collection copying
  - More efficient: avoids copying the entire collection
  - Uses Range to generate indexes and swaps/removes from index slice
  - Uses `n := len(indexes)` to eliminate redundant bounds checks
- Add early return for count <= 0 in SamplesBy (fixes panic with make)
- Add edge case tests for SamplesBy:
  - Test with deterministic random generators (always last index, always 0)
  - Test count = 0 and count = -1 (verifies non-panic behavior)
  - Add panic test for out-of-range index generation
2026-02-08 02:34:53 +01:00
d-enk ac3221dd22 refactor: improve Slice logic and fix docstring (#785)
- Fix docstring: clarify Slice returns a slice view, not a copy
- Reorder boundary checks to use else-if
- Add test case for negative start and end indices
2026-02-08 02:31:32 +01:00
Samuel Berthe 94462b2521 doc: fix package name from "lo" to "it" (#794) 2026-02-08 02:26:36 +01:00
dependabot[bot] 10893596a4 chore(deps): bump webpack from 5.102.0 to 5.105.0 in /docs (#793)
Bumps [webpack](https://github.com/webpack/webpack) from 5.102.0 to 5.105.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Changelog](https://github.com/webpack/webpack/blob/main/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack/compare/v5.102.0...v5.105.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-version: 5.105.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-07 19:56:42 +01:00
d-enk b6d1bf3749 refactor: simplify slice cut/trim prefix/suffix functions (#787)
- CutPrefix now uses HasPrefix instead of manual comparison loop
- CutSuffix now uses HasSuffix instead of manual comparison loop
- TrimPrefix simplified with HasPrefix condition in for loop
- TrimSuffix simplified with HasSuffix condition in for loop

This reduces code duplication and improves readability.
2026-01-27 18:57:30 +01:00
Samuel Berthe fedd0b6d2d doc: explain chunkstring inconsistency (#789)
* doc: explain chunkstring inconsistency

* doc: explain chunkstring inconsistency
2026-01-27 18:53:04 +01:00
d-enk 8211383988 bench: fix iterators to actually iterate in benchmarks (#781)
- Consume iterators with for range instead of discarding with _ =
  Previously iterators were created but never consumed, giving misleading
  performance results (~0.3 ns/op) that only measured iterator creation
- Add BenchmarkItDropLastWhile for testing DropLastWhile performance
- Add BenchmarkItTrim for testing Trim performance
- Add BenchmarkItTrimSuffix for testing TrimSuffix performance
- Replace for better readability `for i := 0; i < n; i++` with `for i := range n`

This fix ensures benchmarks measure actual iterator execution time
rather than just iterator creation time, which is critical for lazy
iterators that don't execute until consumed.
2026-01-26 17:31:36 +01:00
d-enk d61098016a refactor(it): simplify DropLast, TrimSuffix/Prefix and use range loops (#782) 2026-01-22 17:51:20 +01:00
d-enk d8c723125a perf: optimize Sliding by pre-allocating result capacity (#783)
Reducing repeated calculations
2026-01-22 17:49:30 +01:00
dependabot[bot] 0ebc62eff7 chore(deps): bump lodash from 4.17.21 to 4.17.23 in /docs (#777)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.21 to 4.17.23.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.21...4.17.23)

---
updated-dependencies:
- dependency-name: lodash
  dependency-version: 4.17.23
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-22 10:50:33 +01:00
d-enk 2859d7382f perf: use Ternary() instead If().Else() in Range/RangeFrom (#770)
No allocs in it.Range, it.RangeFrom

Add more tests
2026-01-13 11:34:46 +01:00
d-enk 775539002b perf: correct prealloc of the result in FindUniques/Duplicates[By] (#764)
Track exact duplicate count during detection phase instead of
incorrect estimating capacity as len(collection)-len(isDupl).

Also simplify map update logic and rename ok -> seen for clarity.
2026-01-12 21:03:33 +01:00
Uri Simchoni db119e7d60 WithoutNth handle non-comparable types (#774)
Because filtering is by index, WithoutNth can handle any
type.

Co-authored-by: Uri Simchoni <uri@vfunction.com>
2026-01-12 21:01:28 +01:00
d-enk 7a0a18b3a4 perf: optimize PartitionBy by eliminating redundant append (#765)
New groups are now initialized with the first element directly,
avoiding an extra append operation in the hot loop.

Use a one style for lo/it/parallel
2026-01-12 20:58:04 +01:00
d-enk 1c662709bd perf: preallocate result slice in SamplesBy (#766) 2026-01-12 20:56:38 +01:00
Samuel Berthe a2da3973b2 fix(test): Increase timeout values in concurrency tests (#775) 2026-01-12 20:56:25 +01:00
d-enk da548925c1 refactor: simplify it.HasSuffix implementation (#767)
Simplify circular buffer logic:
- simplified calculation of the buf index
- remove append-based construction
- reduce unnecessary copying
2026-01-12 20:52:16 +01:00
d-enk 123d5c2531 refactor: remove some redundant checks (#771) 2026-01-12 20:42:12 +01:00