You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This pull request optimizes the Range class in the following ways:
Produce fewer intermediate objects when reducing a range's space characters to single spaces. This seems to improve bench-subset scores by up to 5%, and bench-satisfies scores to a lesser degree.
Optimize Range formatting with explicit for loops instead, avoiding an intermediate array creation. This seems to improve bench-satisfies and bench-subset scores by up to 20%.
Calculate Range's .range string (used by .format() and .toString()) lazily. This seems to improve bench-satisfies and bench-subset scores by up to 9%.
The external interface for the class stays the same, except for the new internal .formatted property used to cache its lazily calculated string. Range#range property is now also read-only.
There is a new test lazy formatting to ensure full test coverage.
The benchmarks bench-satisfies and bench-subset benefit from these changes, sometimes by up to 40%. Other benchmark results seem to stay the same. Here are the affected benchmarks before:
This pull request optimizes the Range class in the following ways:
.range
string (used by.format()
and.toString()
) lazily. This seems to improve bench-satisfies and bench-subset scores by up to 9%.The external interface for the class stays the same, except for the new internal
.formatted
property used to cache its lazily calculated string.Range#range
property is now also read-only.There is a new test lazy formatting to ensure full test coverage.
The benchmarks bench-satisfies and bench-subset benefit from these changes, sometimes by up to 40%. Other benchmark results seem to stay the same. Here are the affected benchmarks before:
And after:
Originally posted by @jviide in npm/node-semver#726 05T03:41:30.3592718Z �[36;1mEOF�[0m
2024-06-05T03:41:3
The text was updated successfully, but these errors were encountered: