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.
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.
Question
When parsing a large configuration such as
tests/fixtures/configs/sample_06.ios
andauto_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?
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 eachcommit()
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 ciscoconfparseConfigList().get_checkpoint()
, which is a new method in ciscoconfparse2Making ciscoconfparse2 significantly faster is a long-term improvement, if possible.