Optimize Intl and Temporal hot paths with caching and algorithmic fixes#2348
Merged
Merged
Conversation
…es (~12% test262 speedup) - Cache CultureInfo instances in IntlUtilities via ConcurrentDictionary - Cache month/weekday/day-period names and currency data in DefaultCldrProvider - Add static BigInteger constant for IsValidDuration, eliminate array allocation - Build reverse Windows→IANA timezone dictionary for O(1) lookups - Cache GetAvailableTimeZones result (immutable during process lifetime) - Fix duplicate GetMonthsInYear calls per loop iteration in NonIsoCalendars - Direct month computation for fixed-month calendars instead of year-by-year loop - Pre-validate leap month existence before try-catch in FindCalendarReferenceYear - Use GetBitLength() on .NET 5+ instead of ToByteArray() allocation - Parse fraction digits directly without PadRight string allocation - Reconstruct formatted string from parts instead of redundant Format() call Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
lahma
enabled auto-merge (squash)
March 22, 2026 17:50
This was referenced Mar 23, 2026
This was referenced Jun 8, 2026
This was referenced Jun 29, 2026
This was referenced Jul 7, 2026
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
IntlUtilitiesviaConcurrentDictionary— eliminates repeatednew CultureInfo()allocations across all 12+ Intl constructorsIsValidDuration+ eliminatedouble[]array allocation with inline component checksGetAvailableTimeZones()resultGetMonthsInYearper iteration, direct month computation for fixed-month calendars, pre-validate leap months before try-catchGetBitLength()on .NET 5+,ParseFractionDigitshelper to avoidPadRightallocations, reconstruct formatted string from partsBenchmark
Test262 suite (95,988 tests, 0 regressions):
Test plan
dotnet test --configuration Release Jint.Tests.Test262/Jint.Tests.Test262.csproj— 95,988 passed, 0 failuresdotnet test --configuration Release Jint.Tests/Jint.Tests.csproj— 2,764 passed, 0 failuresgit stashbaseline🤖 Generated with Claude Code