====================== SONIC-CFGGEN BENCHMARKING ============================== ============================= NO CHANGE ======================================= 1. Query HWSKU root@r-boxer-sw01:/# python -m cProfile -s cumtime /usr/local/bin/sonic-cfggen -d -v DEVICE_METADATA.localhost.hwsku | head -n 10 ACS-MSN2010 278200 function calls (271111 primitive calls) in 0.866 seconds Ordered by: cumulative time ncalls tottime percall cumtime percall filename:lineno(function) 1 0.007 0.007 0.867 0.867 sonic-cfggen:16() 239 0.004 0.000 0.408 0.002 re.py:230(_compile) 118 0.001 0.000 0.405 0.003 re.py:192(compile) 100 0.001 0.000 0.403 0.004 sre_compile.py:567(compile) 2. Query Platform root@r-boxer-sw01:/# python -m cProfile -s cumtime /usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform | head -n 10 None 184802 function calls (181583 primitive calls) in 0.624 seconds Ordered by: cumulative time ncalls tottime percall cumtime percall filename:lineno(function) 1 0.006 0.006 0.625 0.625 sonic-cfggen:16() 240 0.005 0.000 0.422 0.002 re.py:230(_compile) 118 0.001 0.000 0.418 0.004 re.py:192(compile) 101 0.001 0.000 0.416 0.004 sre_compile.py:567(compile) 3. Render frr.conf.j2 root@r-boxer-sw01:/# python -m cProfile -s cumtime /usr/local/bin/sonic-cfggen -d -y /etc/sonic/deployment_id_asn_map.yml -t /usr/share/sonic/templates/bgpd.conf.j2 | less 455864 function calls (434396 primitive calls) in 1.296 seconds Ordered by: cumulative time ncalls tottime percall cumtime percall filename:lineno(function) 1 0.007 0.007 1.297 1.297 sonic-cfggen:16() 1 0.001 0.001 0.727 0.727 sonic-cfggen:173(main) 240 0.004 0.000 0.409 0.002 re.py:230(_compile) 118 0.001 0.000 0.407 0.003 re.py:192(compile) ============================= LAZY RE ======================================= 1. Query HWSKU root@r-boxer-sw01:/# python -m cProfile -s cumtime /usr/local/bin/sonic-cfggen -d -v DEVICE_METADATA.localhost.hwsku | head -n10 ACS-MSN2010 132380 function calls (127734 primitive calls) in 0.525 seconds Ordered by: cumulative time ncalls tottime percall cumtime percall filename:lineno(function) 1 0.006 0.006 0.526 0.526 sonic-cfggen:16() 1 0.001 0.001 0.325 0.325 sonic-cfggen:174(main) 1 0.007 0.007 0.288 0.288 configdb.py:300(get_config) 596 0.007 0.000 0.268 0.000 client.py:661(execute_command) 2. Query platform root@r-boxer-sw01:/# python -m cProfile -s cumtime /usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform | head -n10 None 43899 function calls (42955 primitive calls) in 0.393 seconds Ordered by: cumulative time ncalls tottime percall cumtime percall filename:lineno(function) 1 0.006 0.006 0.394 0.394 sonic-cfggen:16() 1 0.000 0.000 0.191 0.191 sonic-cfggen:174(main) 151 0.001 0.000 0.186 0.001 re.py:230(_compile) 35 0.001 0.000 0.184 0.005 sre_compile.py:567(compile) 3. Render frr.conf.j2 root@r-boxer-sw01:/# python -m cProfile -s cumtime /usr/local/bin/sonic-cfggen -d -y /etc/sonic/deployment_id_asn_map.yml -t /usr/share/sonic/templates/bgpd.conf.j2 | less 338521 function calls (319256 primitive calls) in 1.158 seconds Ordered by: cumulative time ncalls tottime percall cumtime percall filename:lineno(function) 1 0.007 0.007 1.159 1.159 sonic-cfggen:16() 1 0.001 0.001 0.953 0.953 sonic-cfggen:174(main) 2 0.000 0.000 0.331 0.166 environment.py:809(get_template) 2 0.000 0.000 0.331 0.166 environment.py:794(_load_template) 2 0.000 0.000 0.331 0.165 loaders.py:99(load) 2 0.000 0.000 0.330 0.165 environment.py:553(compile)