-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
refactor(router/atc): do not create new table in split_routes_and_services_by_path()
#12875
Conversation
split_routes_and_services_by_path()
split_routes_and_services_by_path()
@hanshuebner , could you take a look? since you are the author of this feature. |
95eac62
to
0f5c08e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the benefit of this change. I find that the split_routes_and_services_by_path
function was already pretty complicated, and the change further complicates it. I would endorse this change only if the performance benefit is measureable and significant.
I did a simple test:
The master's output:
This PR's output:
Obviously, This PR is faster. @hanshuebner , Do you have more opinions? |
I think the performance optimization is too visible in the code, making it harder to understand and follow. It was already pretty difficult to understand. Given the tiny benefit, I would not go ahead and merge it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chronolaw, I guess you will get the idea?
df9bd56
to
6823dcb
Compare
e9281f6
to
d49ea3b
Compare
@chronolaw here are some of my proposals, feel free to merge them here or ignore: |
Thank you Aapo, it is a good improvement. |
Ok. |
Successfully created cherry-pick PR for |
Summary
The original
split_routes_and_services_by_path()
will create a new table to contains all routes even if no splitting.To erase this overhead, now
split_routes_and_services_by_path()
will insert the cloned routes directly into the passed in table.KAG-4138
Checklist
changelog/unreleased/kong
orskip-changelog
label added on PR if changelog is unnecessary. README.mdIssue reference
Fix #[issue number]