Code Monkey home page Code Monkey logo

Comments (8)

joerick avatar joerick commented on May 18, 2024

Hi @patroqueeet, how are you invoking pyinstrument?

from pyinstrument.

patroqueeet avatar patroqueeet commented on May 18, 2024

sry for the slight delay :/

in docker I do docker-compose exec app pyinstrument ./manage.py test --keepdb services.rest.tests.test_views:AddCompanyTestCase.test_add_company -v 3./manage.py test --keepdb services -e functional -v 2 --failed

Generally spoken: intention is to identify what slows down my tests... including setUp() etc.

from pyinstrument.

joerick avatar joerick commented on May 18, 2024

Not sure what's going on here tbh... my tests in Docker seem to work just as normal. Are you able to make a minimal recreation?

from pyinstrument.

patroqueeet avatar patroqueeet commented on May 18, 2024

@joerick sure. will go and make a docker image for you to reproduce...

from pyinstrument.

patroqueeet avatar patroqueeet commented on May 18, 2024

Hey, tried with a simple model test on docker and found all working as expected. But the problems come on a large Py3 project.

Hence, closing this until I have some further reproducible truth.

Still: for the records https://stackoverflow.com/questions/62220875/profiling-python-in-a-docker-container-is-very-slow-cprofile-and-pyinstrument more people having this issue...

from pyinstrument.

joerick avatar joerick commented on May 18, 2024

Thanks for taking another look! If the problem occurs in cProfile too, it's probably at a lower level than we can fix.

A wild guess at the cause would have me thinking about the gettimeofday syscall in pyinstrument_cext - perhaps this is slower in some Docker containers. This article might add some weight to the idea...

from pyinstrument.

joerick avatar joerick commented on May 18, 2024

I had a thought on this - pyinstrument_cext could add a feature where, rather than calling gettimeofday on every trace event, it checks an internal variable that's being incremented by a thread who is running in a tight loop doing usleep. Perhaps this would be worse performance for systems with vDSO, but it would definitely improve things otherwise...

from pyinstrument.

patroqueeet avatar patroqueeet commented on May 18, 2024

hey, to be honest, I cannot judge if your wild guess is going in the right direction. if you provide me a branch/PR I can check it out and give you some feedback.

from pyinstrument.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.