Automattic / wp-cldr

Use CLDR localization data in WordPress
GNU General Public License v2.0
24 stars 6 forks source link

Should we make `WP_CLDR` a singleton? #93

Open jblz opened 7 years ago

jblz commented 7 years ago

Repeatedly creating a new instance (for repeated lookups, etc.) is an anti-pattern because of the work done during initialization. Even if we use a cache, it's a pretty big hit to do this multiple times per request.

A singleton pattern (forcing use of a static get_instance() method by default) would work around this.