Skip to content

feat: add option WithNestedRandomMapAndSlizeSize to prevent exponential memory growth#94

Merged
geshtng merged 3 commits into
go-faker:mainfrom
geshtng:feature/nested-slice-size-option
Jun 22, 2026
Merged

feat: add option WithNestedRandomMapAndSlizeSize to prevent exponential memory growth#94
geshtng merged 3 commits into
go-faker:mainfrom
geshtng:feature/nested-slice-size-option

Conversation

@geshtng

@geshtng geshtng commented Jun 17, 2026

Copy link
Copy Markdown
Member

Fix #42

Usage:

var users []User

faker.FakeData(&users,
    options.WithRandomMapAndSliceMaxSize(10000), // controls outer []User size
    options.WithNestedRandomMapAndSliceSize(1, 10), // caps all nested slices/maps
)

@geshtng geshtng changed the title feat: add WithNestedRandomMapAndSlizeSize to prevent exponential memory growth feat: add option WithNestedRandomMapAndSlizeSize to prevent exponential memory growth Jun 17, 2026
Comment thread pkg/options/options.go
@geshtng geshtng merged commit d3f48a2 into go-faker:main Jun 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Performance issue when generating 10k elements in array

2 participants