ygot
ygot copied to clipboard
perf(logging): prevent unnecessary processing for debug logging
The debug logging calls can consume significant amount of CPU resources at scale because many of them use function call returns directly as arguments. This resulted in expensive functions being called anyway regardless of the value of debugLibrary
. This commit prevents such unnecessary processing.
This commit also includes performance improvements from reducing expensive string split calls and using more performant int/uint to ascii conversions.
Here are some rough reference numbers from e2e testing sending 2000 leaf-list updates in a SetRequest:
Version | Time |
---|---|
Before #828 | ~2,300 ms |
After #828 | ~1,600 ms |
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
Note: I'm working on getting my username added to our CLA group. Will keep you posted : )
Update: the CLA check is passing now.
Coverage: 88.89% (-1.2%) from 90.12% when pulling ad55b2fcaedf93ff83cf35c0048b15ac883f0352 on jayzhudev:logging-perf into cbef8ea8b7af75441628d44165298fcc3e3bf6d4 on openconfig:master.
@robshakir for any comments before merge. The coverage decreased because the the debugging statements inside the if statements are not covered. Since these are debugging statements I'm ok with them being uncovered.