Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(server-renderer):normalizeValue function prioritizes the judgmen… #13054

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LockingReal
Copy link

…t of values equal to 0, thereby improving performance

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • [√] Other, please describe:

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

  • Yes
  • [√] No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

…t of values equal to 0, thereby improving performance
@LockingReal
Copy link
Author

I have already run the npm run test command locally and passed all of it

@LockingReal
Copy link
Author

LockingReal commented Jul 22, 2023

@sxzz @antfu @sodatea Can you help me check it ~~🥰

@haoqunjiang
Copy link
Member

Not now.

While I appreciate your contribution to the project, please don't @ me unless it's urgent.
Just like you shouldn't call your colleague to review a small refactor on a Sunday morning. It's insensitive and impolite, to say the least.

@LockingReal
Copy link
Author

Not now.

While I appreciate your contribution to the project, please don't @ me unless it's urgent. Just like you shouldn't call your colleague to review a small refactor on a Sunday morning. It's insensitive and impolite, to say the least.

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 😢😣🤕

@LockingReal
Copy link
Author

@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~❤️

@Justineo
Copy link
Member

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
Copy link
Author

LockingReal commented Jul 24, 2023

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.

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.

@LockingReal
Copy link
Author

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.

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 🤕

@Justineo
Copy link
Member

It’s faster only when value is 0.

@Justineo
Copy link
Member

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 🤕

You don’t need to actively find someone to review a minor refactor. Project members may review PRs anytime they feel comfortable with.

@LockingReal
Copy link
Author

LockingReal commented Jul 24, 2023

其实我也不知道怎么找人审稿。我们有类似的时间表吗?我们定期检查它们吗(pr)?我没有太多合作我们项目的经验🤕

你不需要主动找人来审查一个小的重构。项目成员可以在他们觉得舒服的时候随时审查 PR。

Haha, actually I used to do that in other projects, nothing happen...but I current understand. Thank you for your guidance~🥰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants