Fix wasteful allocations and minor perf improvements#2369
Merged
lahma merged 3 commits intoMar 26, 2026
Conversation
- SetPrototype: Remove unnecessary JsSet/HashSet copies in IsDisjointFrom, IsSubsetOf, and IsSupersetOf that were allocating full set copies for read-only or boolean-returning operations - SetPrototype.IsSubsetOf: Remove redundant always-true condition guard - TypeConverter: Cache BigInteger.Pow(2, 64) and BigInteger.Pow(2, 63) as static readonly fields instead of recomputing on every call - JintBinaryExpression: Cache Math.Abs(baseValue) in exponentiation instead of calling it 4 times - HybridDictionary: Replace Enumerable.Empty<T>().GetEnumerator() with Array.Empty<T>() cast to avoid LINQ enumerator allocation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Both Enumerable.Empty<T>().GetEnumerator() and Array.Empty<T>() cast produce the same SZGenericArrayEnumerator allocation. The original code is cleaner and callers already null-check before iterating, so this path is rarely hit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rted features - Add TaskInterop section under Asynchronous Execution explaining automatic .NET Task/ValueTask to JavaScript Promise conversion with usage examples - Add Decorators to ECMAScript proposals (no version yet) feature list Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
lahma
enabled auto-merge (squash)
March 26, 2026 16:30
This was referenced Mar 30, 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
JsSet/HashSetcopies inIsDisjointFrom,IsSubsetOf, andIsSupersetOfthat were allocating full set copies for read-only or boolean-returning operationsBigInteger.Pow(2, 64)andBigInteger.Pow(2, 63)asstatic readonlyfields instead of recomputing on everyToBigInt64/ToBigUint64callMath.Abs(baseValue)in exponentiation instead of calling it 4 timesTest plan
Jint.Tests— 2,807 passed, 0 failedJint.Tests.Test262— 95,985 passed, 0 failed🤖 Generated with Claude Code