Skip to content

perf: Fix performance regression for generator#17627

Closed
liuxingbaoyu wants to merge 2 commits into
babel:mainfrom
liuxingbaoyu:fix-generator-perf
Closed

perf: Fix performance regression for generator#17627
liuxingbaoyu wants to merge 2 commits into
babel:mainfrom
liuxingbaoyu:fix-generator-perf

Conversation

@liuxingbaoyu

@liuxingbaoyu liuxingbaoyu commented Dec 2, 2025

Copy link
Copy Markdown
Member
Q                       A
Fixed Issues? Fixes #1, Fixes #2
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

This fixes the performance regression from v7.26.3 to v7.26.5.
There is 10% performance improvement.
I've tried many methods, but none have been able to fix the performance regression based on the original logic.
These include using Object.assign once, and building a new object in the sorted order, etc.
I don't understand why the performance of methods exported from modules and methods in objects is still different even when we add them to the class prototype.

@babel-bot

babel-bot commented Dec 2, 2025

Copy link
Copy Markdown
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/60353

@liuxingbaoyu

Copy link
Copy Markdown
Member Author

Object.assign(PrinterClass.prototype, deprecatedBabel7Generators, generatorFunctions);
Object.assign(PrinterClass.prototype, {...deprecatedBabel7Generators, ...generatorFunctions});
And constructing a new object and sorting its keys (like ESM exports) is still slow.

@pkg-pr-new

pkg-pr-new Bot commented Dec 2, 2025

Copy link
Copy Markdown

Open in StackBlitz

commit: 1fb11ab

@liuxingbaoyu

Copy link
Copy Markdown
Member Author

It has been replaced by #17642.

@github-actions github-actions Bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Apr 25, 2026
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants