jaswdr / faker

:rocket: Ultimate fake data generator for Go with zero dependencies
https://pkg.go.dev/github.com/jaswdr/faker
MIT License
566 stars 59 forks source link

memoize various read-only arrays #139

Closed sean- closed 1 year ago

sean- commented 1 year ago

Description

Cache array operations to reduce memory utilization and CPU time associated with heap management. faker is now no longer in the hot path when generating random data.

jaswdr commented 1 year ago

LGTM, this is an excellent catch and improvement.

jaswdr commented 1 year ago

Congratulations for your first contribution 🎉 I'll follow up on this topic and start to check benchmarks on generators performance.

jaswdr commented 1 year ago

Changes released in v1.18.0

sean- commented 1 year ago

There's some other low-hanging fruit in the following two that I expect to take a pass at, too, if they end up being critical (vs just inefficient):