Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.8k
perf(server-renderer):normalizeValue function prioritizes the judgmen…#13054
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
perf(server-renderer):normalizeValue function prioritizes the judgmen…#13054
Conversation
…t of values equal to 0, thereby improving performance
I have already run thenpm run test command locally and passed all of it |
LockingReal commentedJul 22, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Not now. While I appreciate your contribution to the project, please don't @ me unless it's urgent. |
I think this is an open source project, and people will not treat it like work. The pressure in this area should not be too great, and I really didn't think too much. I'm very sorry 😢😣🤕 |
@Justineo I see in the PR list that you have participated in some Code review work in some items on the first page of PR. Can you help check it?thanks~❤️ |
I don’t get it how is this improving performance? P.S. Don’t tag people like this unless it’s urgent. It is impolite as soda pointed out to you. |
LockingReal commentedJul 24, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
With the current modification, when value is equal to 0, an unnecessary typeof value=='string 'judgment will be skipped, and a typeof value==='number'&&noUnitNumericStyleProps [key] judgment will be skipped to directly enter the subsequent logic. from the perspective of performance, using the === operator for equality comparison is faster than using the typeof operator for type checking. the === operator only needs to compare if two values are exactly equal, while the typeof operator needs to check the type of the value, which may require more operations. Additionally, typeof also needs to perform string comparisons, which can lead to more time consumption. |
In fact, I don't know how to find someone to review. Do we have a similar schedule? Do we regularly check them(pr)? I don't have much experience in cooperating with our project 🤕 |
It’s faster only when |
You don’t need to actively find someone to review a minor refactor. Project members may review PRs anytime they feel comfortable with. |
LockingReal commentedJul 24, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Haha, actually I used to do that in other projects, nothing happen...but I current understand. Thank you for your guidance~🥰 |
…t of values equal to 0, thereby improving performance
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
When the value is equal to 0, it avoids two typeof judgments and one js object attribute value, which improves performance
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
main
branch for v2.x (or to a previous version branch)fix #xxx[,#xxx]
, where "xxx" is the issue number)If adding anew feature, the PR's description includes:
Other information: