| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
It looks CI isn't running because the repo doesn't allow Actions from outside the faker-ruby namespace itself? So it can't run the github/ or ruby/ namespaced actions that are specified on main 😅 https://github.com/faker-ruby/faker/actions/runs/28623898058 |
Sorry, something went wrong.
- fetch/fetch_all: detect regex-shaped values with start_with?/end_with?
instead of two Regexp matches (which allocate MatchData) per fetch.
- parse: skip the token scan entirely when the fetched value contains no
interpolation token; plain values go straight to numerify.
- Name.first_name: call parse once instead of twice when the result is
non-empty.
Benchmark (Ruby 3.4.9, arm64-darwin25, benchmark-ips):
require 'benchmark/ips'
require 'faker'
Benchmark.ips do |x|
x.config(warmup: 1, time: 2)
x.report('Name.first_name') { Faker::Name.first_name }
x.report('Name.name') { Faker::Name.name }
x.report('Address.city') { Faker::Address.city }
end
Results:
main: Name.first_name 30.582k (+/-15.3%) i/s
Name.name 18.900k (+/- 1.2%) i/s
Address.city 21.428k (+/- 4.6%) i/s
this commit: Name.first_name 61.882k (+/-14.6%) i/s (~2.0x)
Name.name 28.181k (+/- 0.7%) i/s (~1.5x)
Address.city 30.575k (+/- 0.7%) i/s (~1.4x)
| Back | FazBrowse Home | New Git URL |
Motivation / Background
This Pull Request has been created because I want to make some of the most common Faker generators a bit faster, to improve the performance of my test suite and database seeds at work :)
The changes in this PR were generated using Claude Code w/ Fable 5. They have been reviewed and tested by me for correctness.
The changes in this PR include:
I can split these changes up further into separate PRs if desired.
Additional information
Benchmark (Ruby 3.4.9, arm64-darwin25, benchmark-ips):
Results:
main: Name.first_name 30.582k (+/-15.3%) i/s Name.name 18.900k (+/- 1.2%) i/s Address.city 21.428k (+/- 4.6%) i/s this commit: Name.first_name 61.882k (+/-14.6%) i/s (~2.0x) Name.name 28.181k (+/- 0.7%) i/s (~1.5x) Address.city 30.575k (+/- 0.7%) i/s (~1.4x)Checklist
Before submitting the PR make sure the following are checked:
If you're proposing a new generator or locale: