Skip to content

Commit 5361794

Browse files
[sonic-cfggen] remove lazy_re workaround due to many optimizations done (sonic-net#8226)
lazy_re had an issue when importing sonic-cfggen in another application that uses re.search(). There is no much improvement of lazy_re today after many other good optimization work done for sonic-cfggen. It served as a quick temporary solution. Some quick test for fast-reboot and warm-reboot done on top of 201911 branch: Fast-reboot: from ASIC reset to ports in up state: with lazy_re: 18 sec without lazy_re: 18 sec Warm-reboot: LAG restoration time: with lazy_re: 73 sec without lazy_re: 72 sec So, there is no real optimization since the number of sonic-cfggen calls is greatly reduced in latest SONiC. This means it is time to revert this change. Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
1 parent d37361b commit 5361794

File tree

3 files changed

+0
-32
lines changed

3 files changed

+0
-32
lines changed

src/sonic-config-engine/lazy_re.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/sonic-config-engine/setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
# Common modules for python2 and python3
4141
py_modules = [
4242
'config_samples',
43-
'lazy_re',
4443
'minigraph',
4544
'openconfig_acl',
4645
'portconfig',

src/sonic-config-engine/sonic-cfggen

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@ See usage string for detail description for arguments.
1717

1818
from __future__ import print_function
1919

20-
# monkey patch re.compile to do lazy regular expression compilation.
21-
# This is done to improve import time of jinja2, yaml, natsort modules, because they
22-
# do many regexp compilation at import time, so it will speed up sonic-cfggen invocations
23-
# that do not require template generation or yaml loading. sonic-cfggen is used in so many places
24-
# during system boot up that importing jinja2, yaml, natsort every time
25-
# without lazy regular expression compilation affect boot up time.
26-
# FIXME: remove this once sonic-cfggen and templates dependencies are replaced with a faster approach
27-
import lazy_re
28-
2920
import argparse
3021
import contextlib
3122
import jinja2

0 commit comments

Comments
 (0)