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

Optimize the ConfigType.isValidType method #5432

Closed
xiaoheng1 opened this issue Apr 21, 2021 · 5 comments
Closed

Optimize the ConfigType.isValidType method #5432

xiaoheng1 opened this issue Apr 21, 2021 · 5 comments
Labels
kind/enhancement Category issues or prs related to enhancement.
Milestone

Comments

@xiaoheng1
Copy link
Contributor

motivation:

Optimize the ConfigType.isValidType method

@realJackSun
Copy link
Collaborator

realJackSun commented Apr 21, 2021

改动之前:每次调用isValidType,都会遍历一遍所有的ConfigType
改动之后:用一个localMap缓存所有的Type,每次调用isValidType时,直接从localMap中取即可。
看起来可以优化性能

@realJackSun
Copy link
Collaborator

realJackSun commented Apr 21, 2021

My question is: can you replace "Map" with "Set". It seems more convinent to use "Set" in this modification.

@xiaoheng1
Copy link
Contributor Author

Generally speaking, we use configType to get the corresponding value, set cannot do this step.

@KomachiSion KomachiSion added the kind/enhancement Category issues or prs related to enhancement. label Apr 22, 2021
@KomachiSion KomachiSion added this to the 1.4.2 milestone Apr 22, 2021
@KomachiSion
Copy link
Collaborator

I have no idea about the frequent count of this method.
If no much frequently called, I think the enhancement is not neccessary.

@xiaoheng1
Copy link
Contributor Author

The isValidType method is used in com.alibaba.nacos.config.server.controller.ConfigController#publishConfig.

So I think it can be enhanced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Category issues or prs related to enhancement.
Projects
None yet
Development

No branches or pull requests

3 participants