Skip to content

refactor(core): improve stringify#59745

Closed
arturovt wants to merge 1 commit intoangular:mainfrom
arturovt:refactor/core-stringify-improve-speed
Closed

refactor(core): improve stringify#59745
arturovt wants to merge 1 commit intoangular:mainfrom
arturovt:refactor/core-stringify-improve-speed

Conversation

@arturovt
Copy link
Copy Markdown
Contributor

In this commit, we improve branching in the stringify function, which is widely used by the framework, and add additional comments for clarification. Benchmark results of the old and new implementations (using slice makes it slightly faster) are as follows:

stringify (old version) x 117,945,419 ops/sec ±5.25% (55 runs sampled)
stringify (new version) x 136,692,820 ops/sec ±4.82% (56 runs sampled)

@angular-robot angular-robot bot added the area: core Issues related to the framework runtime label Jan 28, 2025
@ngbot ngbot bot added this to the Backlog milestone Jan 28, 2025
Copy link
Copy Markdown
Member

@pkozlowski-opensource pkozlowski-opensource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thnx for the PR. While we could change to the slice usage I feel like most of the added comments just repeat what is written in the code and add to the noise instead of helping.

@arturovt arturovt force-pushed the refactor/core-stringify-improve-speed branch from becc66e to 551db8a Compare January 28, 2025 09:26
@arturovt
Copy link
Copy Markdown
Contributor Author

@pkozlowski-opensource removed comments.

@arturovt arturovt force-pushed the refactor/core-stringify-improve-speed branch from 551db8a to 832b85e Compare January 28, 2025 09:38
@arturovt
Copy link
Copy Markdown
Contributor Author

@alan-agius4 I removed else-if back to if on the new line. But with the else-if it just had few less jmp instructions in the opt code.

@arturovt arturovt force-pushed the refactor/core-stringify-improve-speed branch from 832b85e to f70b370 Compare January 28, 2025 17:15
@arturovt arturovt force-pushed the refactor/core-stringify-improve-speed branch from f70b370 to a83c263 Compare January 30, 2025 20:00
@arturovt arturovt force-pushed the refactor/core-stringify-improve-speed branch from a83c263 to f6bc3aa Compare February 15, 2025 23:57
In this commit, we improve branching in the `stringify` function, which is widely used by the framework, and add additional comments for clarification. Benchmark results of the old and new implementations (using `slice` makes it slightly faster) are as follows:
```
stringify (old version) x 117,945,419 ops/sec ±5.25% (55 runs sampled)
stringify (new version) x 136,692,820 ops/sec ±4.82% (56 runs sampled)
```
@arturovt arturovt force-pushed the refactor/core-stringify-improve-speed branch from f6bc3aa to 3d496a2 Compare February 19, 2025 06:56
@pkozlowski-opensource pkozlowski-opensource added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Feb 19, 2025
thePunderWoman pushed a commit that referenced this pull request Feb 19, 2025
In this commit, we improve branching in the `stringify` function, which is widely used by the framework, and add additional comments for clarification. Benchmark results of the old and new implementations (using `slice` makes it slightly faster) are as follows:
```
stringify (old version) x 117,945,419 ops/sec ±5.25% (55 runs sampled)
stringify (new version) x 136,692,820 ops/sec ±4.82% (56 runs sampled)
```

PR Close #59745
@thePunderWoman
Copy link
Copy Markdown
Contributor

This PR was merged into the repository by commit cf3a507.

The changes were merged into the following branches: main, 19.1.x

@arturovt arturovt deleted the refactor/core-stringify-improve-speed branch February 19, 2025 15:28
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants