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

ciscoconfparse2 is slower than ciscoconfparse #2

Open
mpenning opened this issue Dec 14, 2023 · 0 comments
Open

ciscoconfparse2 is slower than ciscoconfparse #2

mpenning opened this issue Dec 14, 2023 · 0 comments
Labels
question Further information is requested

Comments

@mpenning
Copy link
Owner

mpenning commented Dec 14, 2023

Question

When parsing a large configuration such as tests/fixtures/configs/sample_06.ios and auto_commit=True, ciscoconfparse2 version 0.2.5 takes about 1.55 seconds on my system; however, parsing the same configuration with ciscoconfparse version
1.9.41 takes about 1.40 seconds.

sample_06.ios has over 4700 physical and virtual interfaces.

Why is ciscoconfparse2 about 10% slower?

try:
    # fail if we can't import ciscoconfparse2
    from ciscoconfparse2 import CiscoConfParse
except BaseException:
    from ciscoconfparse import CiscoConfParse

# auto_commit defaults True in ciscoconfparse2
parse = CiscoConfParse('tests/fixtures/configs/sample_06.ios', syntax='ios')

Answer:

This is due to the safety features that ciscoconfparse2 has; specifically it's due to the additional configuration safety built with in the ConfigList().get_checkpoint() method. get_checkpoint() is called with each commit() operation.

As of version 0.2.5, there are two big rocks that could chew up a lot of time:

  • assign_parent_to_closing_braces() which is a function from legacy ciscoconfparse
  • ConfigList().get_checkpoint(), which is a new method in ciscoconfparse2

Making ciscoconfparse2 significantly faster is a long-term improvement, if possible.

@mpenning mpenning added the question Further information is requested label Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant