Commit graph

3 commits

Author SHA1 Message Date
92b64630dc
perf: pre-allocate Filter result slice
Improves Filter performance by pre-allocating result slice with
input capacity instead of growing dynamically.

Performance improvements:
- Time: 1867 ns/op → 1717 ns/op (8% faster)
- Allocations: 10 → 1 (90% reduction)

This significantly reduces GC pressure for high-frequency operations.

Also updates Join test to expect empty slice [] instead of nil,
which is better Go practice.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-14 13:44:07 +01:00
c53d46816f
refactor: migrate to Go 1.22 slices/cmp, update linters
Replace usage of golang.org/x/exp/constraints with Go 1.22 cmp/slices.
Update .golangci.yml to new v2 format and enable gofmt/goimports.
Refactor imports and type constraints across codebase for consistency.
2025-09-01 23:08:10 -04:00
Andy Long
0bc3a54efd
Adding some new funky functions (#32)
* Adding some new funky functions which I find useful

Created a Tuple struct as some of the new functions require you to return a new slice with two fields which is the result of the new functions

Created the Join, JoinProjection, Range, SumMap, Zip functions, ecah fuction is documented with how it works and had a unit test or maybe more

* Added in an OrderBy function

* Documentation comment for OrderBy which I missed out

* Adding a Unit test for JoinProject function

Updated the comments on the Join & OrderBy functions so they make a little more sense.

Covered an extra test case with the Join test, where the left set has more data than the right and so the Right handside array of the join is empty
2022-09-04 09:21:31 +02:00