You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've done some micro benchmarks of OCPP and found that a few hot spots that are easy to optimize.
Currently OCPP caches the JSON schema as a Python dict. That prevents reading to disk and parsing the schema if a schema is used more than one time. But still every time a schema is used this dict has to be turned into a Draft4Validator instance
Caching the Draft4Validator instance reduces the time to handle a Call significantly.
I've used the following script to benchmark.
It requires pytest-benchmark. This package doesn't support async functions natively, but @mbello provided some code to fix that in this issue.
I've done some micro benchmarks of OCPP and found that a few hot spots that are easy to optimize.
Currently OCPP caches the JSON schema as a Python dict. That prevents reading to disk and parsing the schema if a schema is used more than one time. But still every time a schema is used this dict has to be turned into a
Draft4Validator
instanceCaching the
Draft4Validator
instance reduces the time to handle aCall
significantly.I've used the following script to benchmark.
It requires
pytest-benchmark
. This package doesn't support async functions natively, but @mbello provided some code to fix that in this issue.The script can be executed using `
Next I used
py-spy
to create a Flamegraph of the test run. That allowed me to find hot spots in the code.You can use py-spy like this:
That outputs a file
profile.svg
that you can inspect in the browser.The text was updated successfully, but these errors were encountered: