npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@formatjs/intl-localematcher

v0.7.4

Published

Intl.LocaleMatcher ponyfill

Readme

Intl LocaleMatcher

We've migrated the docs to https://formatjs.github.io/docs/polyfills/intl-localematcher.

Performance

This package implements a highly optimized three-tier locale matching algorithm that provides excellent performance even with large locale sets (700+ locales).

Benchmark Results

Benchmarked with 725 CLDR locales on Node.js:

| Scenario | Latency | Throughput | Relative Performance | | ------------------------------------------------------- | ------- | ---------- | -------------------- | | Tier 1: Exact Match (en) | 1.38ms | 730 ops/s | Baseline | | Tier 2: 1-level Fallback (en-USen) | 1.39ms | 725 ops/s | 1.01x slower | | Tier 2: Maximized Match (zh-TWzh-Hant) | 1.40ms | 720 ops/s | 1.02x slower | | Tier 3: CLDR Distance (sr-Latn-BAsr-Latn-BA) | 1.38ms | 730 ops/s | 1.00x slower | | Tier 3: Fuzzy Match (en-XZen) | 1.50ms | 670 ops/s | 1.09x slower |

Real-world Impact

The optimization in this package resolved issue #4936, where DurationFormat instantiation was taking 610ms on React Native/Hermes due to slow locale matching against 700+ auto-loaded locales.

After optimization:

  • Common case (en-US): 1.39ms per instantiation
  • Chinese locales (zh-TW): 1.40ms per instantiation
  • Serbo-Croatian locales: 1.38ms per instantiation

Performance improvement: 439x faster 🚀

Three-Tier Optimization

The algorithm uses three tiers for maximum performance:

  1. Tier 1 (Exact Match): O(1) Set lookup for exact locale matches
  2. Tier 2 (Maximization + Fallback): Progressive subtag removal with locale maximization
  3. Tier 3 (CLDR Distance): Full UTS #35 Enhanced Language Matching with memoization

This design ensures that common cases (exact matches and simple fallbacks) are extremely fast, while complex scenarios (script/region matching, language distances) still perform well.