23 Commits

Author SHA1 Message Date
Samuel Berthe fd29945fb1 refactor(benchmarks): reorganize benchark/ directory (#840) 2026-03-08 00:14:41 +01:00
Samuel Berthe d66010f2c1 perf: replace NthOrEmpty with direct loops in Zip2-Zip9 (#838)
Replace the single interleaved loop calling NthOrEmpty per element
with separate per-slice loops using direct index access. This
eliminates function call overhead (NthOrEmpty → sliceNth → bounds
check) and improves CPU cache locality by processing each input
slice contiguously.

The result slice is zero-initialized by make(), so out-of-bounds
elements (when slices have different lengths) are already zero —
no explicit zero-filling needed.

Benchstat (Apple M3, 6 runs, -cpu=1):

                    │   before    │           after            │
                    │   sec/op    │  sec/op    vs base         │
Zip2_Equal/n_10       65.89n ± 22%  52.35n ± 13%  -20.54% (p=0.002)
Zip2_Equal/n_100      440.6n ± 21%  382.3n ± 13%  -13.22% (p=0.004)
Zip2_Equal/n_1000     4.232µ ± 82%  3.173µ ± 12%  -25.02% (p=0.002)
Zip2_Unequal/n_10     69.35n ± 65%  46.16n ±  1%  -33.43% (p=0.002)
Zip2_Unequal/n_100    461.8n ±101%  293.1n ± 17%  -36.53% (p=0.002)
Zip2_Unequal/n_1000   3.623µ ± 26%  2.301µ ± 17%  -36.49% (p=0.002)
geomean               492.4n        354.3n        -28.05%
2026-03-06 22:57:44 +01:00
Samuel Berthe fa095e4b4f fix(doc): fix go playground demo URL (#832)
* fix(doc): fix go playground demo URL

* fix(doc): add more go playground demo URL
2026-03-06 00:09:59 +01:00
Samuel Berthe 7f0c2e0297 feat: adding UnzipByErrX helpers 2026-03-02 16:06:51 +01:00
Samuel Berthe 7c55e5b6e3 feat: adding CrossJoinByErrX helpers 2026-03-02 16:06:51 +01:00
Samuel Berthe e94aa8d408 feat: adding ZipByErrX helpers 2026-03-02 16:06:51 +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
Nathan Baulch e7386d9246 lint: fix inconsistent callback function parameter names (#730)
* Fix linting

* Use is.ElementsMatch

This will ignore the ordering of the final intersection. Especially
important when checking old versions of go that do not guarantee an order
when iterating through maps.

* lint: fix inconsistent callback function parameter names

* lint: rename "iteratee" to "transform" for *Map helpers

* lint: rename "project" parameters to "transform"

* lint: rename "cb" parameters to "callback"

* lint: rename "iteratee" to "callback" for ForEach helpers

---------

Co-authored-by: Franky W. <frankywahl@users.noreply.github.com>
Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2025-11-06 18:05:11 +01:00
Nathan Baulch f5aac81cc0 lint: enable gofumpt extra rules (#690)
Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2025-09-26 13:32:59 +02:00
Nathan Baulch 3e11f11781 docs: grammar improvements (#673)
* lint: pin golangci-lint version

* docs: grammar fixes

* docs: remove "truthy" terminology

* docs: remove "array" terminology

* docs: grammar fixes

* Update .github/workflows/lint.yml

---------

Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
2025-09-24 20:59:41 +02:00
Samuel Berthe 3bc887c57c doc: adding go playground examples 2025-09-23 14:54:30 +02:00
Samuel Berthe 68d57fe402 fix(zipx): fix the max length calculation (#649) 2025-07-06 17:28:27 +02:00
Samuel Berthe 2876510f3c CrossJoinX + CrossJoinByX 2025-01-25 00:19:26 +01:00
Samuel Berthe 61209816d1 feat: speed up loops by reducing allocations (#475) 2024-06-28 01:35:57 +02:00
d-enk 05a9bc93bd style: no extra any type parameter (#429) 2024-06-27 13:43:43 +02:00
Samuel Berthe a66bf34300 proposal: adding zipby + unzipby (#449)
* feat: adding zipby + unzipby

* Update README.md
2024-06-27 12:52:42 +02:00
Samuel Berthe 7887963db8 feat: name each callback/iteratee/predicate arguments in order to improve autocompletion
closes #242
2022-10-13 22:25:33 +02:00
Samuel Berthe c6b8b1e628 doc: adding examples 2022-10-06 22:46:47 +02:00
lu4p 305f565368 remove unnecessary explicit typeparams (#134) 2022-05-11 13:10:36 +02:00
CorentinClabaut 5cba7b25f0 Implement Unpack{2->9} 2022-04-27 08:22:11 +02:00
CorentinClabaut 5715ed654c Add helper function to create tuple from a list of values 2022-04-12 14:45:48 +02:00
Samuel Berthe 38ec25f813 chore: remove dead code 2022-04-12 01:20:48 +02:00
Samuel Berthe a482eff46c feat: adding tuple types (from 2 to 9) and zip+unzip functions 2022-03-05 20:13:49 +01:00