FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

add Japanese actual zipcodes in locals/ja.yml by POPPIN-FUMI · Pull Request #2297 · faker-ruby/faker · GitHub

add Japanese actual zipcodes in locals/ja.yml - #2297

Merged
vbrazo merged 1 commit into
faker-ruby:masterfrom
POPPIN-FUMI:zipcode_ja
Apr 11, 2021
Merged

add Japanese actual zipcodes in locals/ja.yml#2297
vbrazo merged 1 commit into
faker-ruby:masterfrom
POPPIN-FUMI:zipcode_ja

Conversation

Copy link
Copy Markdown
Contributor

Added Japanese actual zipcodes data in locales/ja.yml

Resource:
Japan Post Download Site

Example

Faker::Config.locale = 'ja'
Faker::Address.postcode
>> 231-0847

vbrazo merged commit 38e3d24 into faker-ruby:master Apr 11, 2021
gongo added a commit to gongo/faker that referenced this pull request May 18, 2021
vbrazo pushed a commit that referenced this pull request May 30, 2021
* 🐛 Fix indentation ( `ja.faker.name` to `ja.faker.color.name` )

via #2315

* 🎨 Convert a huge one-line array to multiple lines

Because the file cannot be opened with a weak editor...

* 🐛 Japanese postcode has a hyphen.

via: #2297

* Update test/test_ja_locale.rb

Co-authored-by: Koichi ITO <koic.ito@gmail.com>

Co-authored-by: Koichi ITO <koic.ito@gmail.com>
thdaraujo added a commit that referenced this pull request Jan 31, 2026
…ormat

Removes the full list of japanese postcodes in favor or a simple 7-digit format:
"###-####".

The reason is for performance, as generating a postcode in this locale was very expensive.

Japanese postal codes were changed from  a 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 `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
```
thdaraujo added a commit that referenced this pull request Jan 31, 2026
…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 `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%.
thdaraujo added a commit that referenced this pull request Jan 31, 2026
…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%.
thdaraujo added a commit that referenced this pull request Jan 31, 2026
…ormat (#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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL