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 find method #226

Merged
merged 1 commit into from Jan 9, 2022
Merged

Conversation

ivan-tymoshenko
Copy link
Collaborator

I refactored the find method. The main things that were changed:

  • removed double path/prefix checking (in the find and findMatchingChild methods)
  • removed unnecessary path splitting, I replaced it on just path pointer
  • a bunch of other small optimizations

@ivan-tymoshenko
Copy link
Collaborator Author

depends on #224

@ivan-tymoshenko
Copy link
Collaborator Author

Benchmark results:

Before:

Снимок экрана 2021-12-21 в 22 54 48

After:

image

@ivan-tymoshenko
Copy link
Collaborator Author

There is one thing that worries me. If someone can explain under what conditions this code can be executed, I will be very grateful. Because I think that this is an unreachable path of the code and tests also don't cover it.

return this._getWildcardNode(wildcardNode, originalPath, pathLenWildcard, derivedConstraints, params)

@mcollina
Copy link
Collaborator

Good job!!!!

Copy link
Collaborator

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Owner

@delvedor delvedor left a comment

Choose a reason for hiding this comment

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

Heya! The changes looks good, but I would like to take a little more time to review them! I'm currently on PTO, I'll take a look as soon as I'm back :)

Copy link
Owner

@delvedor delvedor left a comment

Choose a reason for hiding this comment

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

Great work!

@delvedor delvedor merged commit 1b88cf2 into delvedor:main Jan 9, 2022
@ivan-tymoshenko ivan-tymoshenko deleted the optimize-find-method branch April 17, 2022 14:15
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.

None yet

3 participants