• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IBM / fp-go / 28335138290
63%

Build:
DEFAULT BRANCH: main
Ran 28 Jun 2026 08:34PM UTC
Jobs 10
Files 983
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

28 Jun 2026 08:34PM UTC coverage: 62.823% (-0.006%) from 62.829%
28335138290

push

github

web-flow
perf(array): pre-size Ap and Flatten results (#190)

* perf(array): pre-size Ap and Flatten results

array.Ap and array.Flatten both routed through MonadChain, which grows the
result from nil and (for Ap) allocates an intermediate slice per function.
Their output lengths are known up front -- len(fab)*len(fa) for the
applicative cartesian product and the sum of inner lengths for flatten -- so
build the result in a single pre-sized allocation.

Benchmarks (added):

  BenchmarkAp        6 -> 1 allocs/op (-83%), 155 -> 66 ns/op
  BenchmarkFlatten   3 -> 1 allocs/op (-67%),  51 -> 24 ns/op

Signed-off-by: Nishant Mehta <nishantmehta.n@gmail.com>

* perf(array): use slices.Concat and slices.Grow for Flatten and Ap

Address review feedback by replacing the hand-rolled pre-sizing with the
idiomatic standard library helpers (Go 1.21+, compatible with the module's
1.24 requirement):

- Flatten delegates to slices.Concat, which sizes the result in a single
  allocation.
- MonadAp allocates its result once via slices.Grow, the same idiom
  slices.Concat uses internally.

Both return a nil slice for an empty result, which is a valid representation
of the empty array. The doc comments now state this, and the TestNilSlice_*
assertions are relaxed to check only that the result is empty.

Benchmarks are unchanged at a single allocation per call:

  BenchmarkAp        240 B/op, 1 allocs/op
  BenchmarkFlatten   128 B/op, 1 allocs/op

Signed-off-by: Nishant Mehta <nishantmehta.n@gmail.com>

---------

Signed-off-by: Nishant Mehta <nishantmehta.n@gmail.com>

33038 of 52589 relevant lines covered (62.82%)

533.64 hits per line

Coverage Regressions

Lines Coverage ∆ File
6
98.16
-1.21% array/generic/array.go
2
62.03
-0.58% context/readerioresult/reader.go
Jobs
ID Job ID Ran Files Coverage
1 v1-go-1.21.x - 28335138290.1 28 Jun 2026 08:34PM UTC 456
31.83
GitHub Action Run
2 v1-go-1.24.x - 28335138290.2 28 Jun 2026 08:34PM UTC 498
27.22
GitHub Action Run
3 v1-go-1.20.x - 28335138290.3 28 Jun 2026 08:34PM UTC 456
31.83
GitHub Action Run
4 v1-go-1.22.x - 28335138290.4 28 Jun 2026 08:34PM UTC 498
27.22
GitHub Action Run
5 v1-go-1.25.x - 28335138290.5 28 Jun 2026 08:35PM UTC 498
27.22
GitHub Action Run
6 v2-go-1.24.x - 28335138290.6 28 Jun 2026 08:37PM UTC 884
58.02
GitHub Action Run
7 v1-go-1.26.x - 28335138290.7 28 Jun 2026 08:35PM UTC 498
27.22
GitHub Action Run
8 v2-go-1.26.x - 28335138290.8 28 Jun 2026 08:37PM UTC 884
58.02
GitHub Action Run
9 v1-go-1.23.x - 28335138290.9 28 Jun 2026 08:34PM UTC 498
27.22
GitHub Action Run
10 v2-go-1.25.x - 28335138290.10 28 Jun 2026 08:37PM UTC 884
58.02
GitHub Action Run
Source Files on build 28335138290
  • Tree
  • List 983
  • Changed 4
  • Source Changed 0
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #28335138290
  • dfc0c4b0 on github
  • Prev Build on main (#28335121598)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc