| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…ormat Replaces the full list of japanese postcodes in favor of a simple 7-digit format: "###-####". The reason is for performance, as generating a postcode in this locale is too expensive. Japanese postal codes were changed from a simple pattern to a list of real postal codes, introduced in #2297. The problem is that when running Faker on `locale = 'ja'`, about 60% of the time to load and call `Faker::Address.postalcode` is spent reading and parsing the [ja/address.yml](https://github.com/faker-ruby/faker/blob/main/lib/locales/ja/address.yml) file, which has 2.2mb. Benchmark: ``` Postcode - Smaller Address File: 1.2 i/s Postcode: 0.7 i/s - 1.65x slower 1.34 s/i vs 811.55 ms/i ``` This has the potential to improve the performance of generating postcodes in japanese by 65%.
| assert_kind_of String, Faker::Subscription.status | ||
| assert_not_english(Faker::Subscription.status) | ||
| assert_kind_of String, Faker::Subscription.payment_method | ||
| assert Array.new(10) { Faker::Subscription.payment_method }.any? { |word| !word.match?(/[a-zA-Z]/) } |
There was a problem hiding this comment.
this test would randomly generate words that often wouldn't match the filter.
The weird thing is that it should have been happening on main too.
Sorry, something went wrong.
There was a problem hiding this comment.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
(fixes #3200)
This PR replaces the full list of postcodes with a 7-digit format for ja/address.yml.
The reason is for performance, as generating a postcode in this locale
is too expensive.
Japanese postal codes were changed from a simple pattern to a list of real postal codes, introduced in #2297.
The problem is that when running Faker on locale = 'ja', about 60% of the time to load and call Faker::Address.postalcode is spent reading and parsing the ja/address.yml file, which has 2.2mb.
Benchmark:
This has the potential to improve the performance of generating
postcodes in japanese by 65%, as well as loading in general.
Gem size will also decrease by 200kb. 🎉
1.6M -> 1.4M