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

Eliminate linear search for active parse tree #84

Merged
merged 2 commits into from
Feb 17, 2023

Conversation

rcmcdonald91
Copy link
Contributor

This eliminates the need to perform a linear search every time cligen_pt_active_get is called. Instead we can just carry a pointer to the active pt_head structure on the cligen_handle and find it quickly when evaluating every line of input.

Copy link
Member

@olofhagsand olofhagsand left a comment

Choose a reason for hiding this comment

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

Do you have some performance measurement, using just "time" or a perf analysis, to show a benefit of the optimization?

cligen_pt_head.c Outdated Show resolved Hide resolved
@rcmcdonald91
Copy link
Contributor Author

good question, I will see about coming up with a test. This might indeed be a premature optimization, but it was something that caught my eye while studying the code.

@olofhagsand olofhagsand merged commit 7acba77 into clicon:master Feb 17, 2023
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.

2 participants