Skip to content

Commit aa70c59

Browse files
authored
perf: replaces list of postcodes in ja/address.yml with a 7-digit format (#3201)
* perf: replaces list of postcodes in `ja/address.yml` with a 7-digit format 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%. * fix: remove flaky specs
1 parent 30e8a92 commit aa70c59

File tree

2 files changed

+1
-120288
lines changed

2 files changed

+1
-120288
lines changed

0 commit comments

Comments
 (0)