-
-
Notifications
You must be signed in to change notification settings - Fork 433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expected performance of coveragepy? #1862
Comments
The first thing to check is what tracer you are using. Coverage.py has a C tracer and a Python tracer. You want the C tracer. It still adds overhead to your execution, but less than the Python tracer. Add
|
This is what I get with sys debug:
I guess tracer is not the problem. When I run with debug, I immediately see debug output, but then nothing changes for ~12s and only after that time I see tests start running. |
OK, it's good that you have the right pieces in place. Is it possible to give me a way to reproduce the problem? |
Yes, it should be possible to run official odoo docker, like:
With Though when I tested same thing on official image, I noticed that there was no delay, even though tests with coverage still run about 30% slower than without (for this Now regarding initial delay of 12-13s, it looks like it is related with Python 3.12 version or maybe some packages on that version specifically. The reason official image has no delay, because they still use 3.10 python. I use 3.12. To make sure it was the case, I switched my source code all the way back since 3.10 was used. And then I noticed that delay was gone as well. What I also noticed, was that when that delay is happening, if I click runner.run()
File "/opt/odoo/venv/lib/python3.12/site-packages/coverage/execfile.py", line 211, in run
exec(code, main_mod.__dict__)
File "/opt/odoo/odoo/odoo-bin", line 5, in <module>
import odoo
File "/opt/odoo/odoo/odoo/__init__.py", line 77, in <module>
import PyPDF2
File "/opt/odoo/venv/lib/python3.12/site-packages/PyPDF2/__init__.py", line 10, in <module>
from ._encryption import PasswordType
File "/opt/odoo/venv/lib/python3.12/site-packages/PyPDF2/_encryption.py", line 36, in <module>
from .generic import (
File "/opt/odoo/venv/lib/python3.12/site-packages/PyPDF2/generic/__init__.py", line 36, in <module>
from ._annotations import AnnotationBuilder
File "/opt/odoo/venv/lib/python3.12/site-packages/PyPDF2/generic/_annotations.py", line 3, in <module>
from ._base import (
File "/opt/odoo/venv/lib/python3.12/site-packages/PyPDF2/generic/_base.py", line 35, in <module>
from .._codecs import _pdfdoc_encoding_rev
File "/opt/odoo/venv/lib/python3.12/site-packages/PyPDF2/_codecs/__init__.py", line 3, in <module>
from .adobe_glyphs import adobe_glyphs
File "/opt/odoo/venv/lib/python3.12/site-packages/PyPDF2/_codecs/adobe_glyphs.py", line 13437, in <module>
_complete()
File "/opt/odoo/venv/lib/python3.12/site-packages/PyPDF2/_codecs/adobe_glyphs.py", line 13430, in _complete
def _complete() -> None: So I wonder maybe it is related with Odoo uses newer PyPDF2, if python is greater than 3.10 (https://github.com/odoo/odoo/blob/7e536998d84744a464e91fa5e056fc06f7796d6f/requirements.txt#L55):
|
Also observing this issue on
|
Seems related to #1287 |
I wonder what is the expected performance of coverage? In my case it looks like some tests run 2x slower than without coverage
I am using python 3.12 with standard unittest framework.
Also, I noticed there is kind of big overhead before anything starts running, when you enable coverage. My app starts in about 1s, but if I enable
coverage
it starts running tests after about ~13s.Here is a small sample of tests that are run without coverage:
Here same tests with coverage:
All tests run slower especially ones with lots of queries. Note, odoo is tightly coupled with database engine (postgres), so there are lots of tests that depend on database. Not sure if its relevant here.
My
.coveragerc
:I run coverage like this:
os.execvp(cmd, cmd_args)
Where
cmd
iscoverage
andcmd_args = ['coverage', 'run', '/opt/odoo/odoo/odoo-bin', '-d', 'odoodb', '--stop-after-init', '--test-enable', '-u', 'my-module']
P.S. I also run it via docker container.
The text was updated successfully, but these errors were encountered: