Skip to content
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

Improve start-up time (client) #14

Closed
JamesHutchison opened this issue May 16, 2023 · 4 comments
Closed

Improve start-up time (client) #14

JamesHutchison opened this issue May 16, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@JamesHutchison
Copy link
Owner

There appears to be an overhead to running things caused by pytest. This overhead seems to occur prior to running the plugin. If we can jump straight to running the plugin, running tests will be very quick.

@JamesHutchison JamesHutchison added the enhancement New feature or request label May 16, 2023
@JamesHutchison
Copy link
Owner Author

Out of scope for this is improving the start-up time incurred by using jurigged. In tests, start-up could be 50% slower with jurigged. It would be better if it was about the same as normal.

@JamesHutchison
Copy link
Owner Author

#17 will cover the jurigged overhead

@JamesHutchison JamesHutchison changed the title Improve start-up time Improve start-up time (client) May 16, 2023
@JamesHutchison
Copy link
Owner Author

Profiling this, I'm actually seeing the time sink seems to be this:

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    1.602    1.602    1.602    1.602 {method 'recv_into' of '_socket.socket' objects}

When I profile the opposite end, the test is much faster, so perhaps there's a bit of dead time in the communication that could be reduced

@JamesHutchison
Copy link
Owner Author

JamesHutchison commented May 17, 2023

This branch experiments with substituting the built in XMLRPC library with Robyn. The performance is nearly identical so its not worth making the switch for that reason alone.

https://github.com/JamesHutchison/pytest-hot-reloading/tree/robyn-experiment

Without debugging, it looks like it's getting :

  • about 200 - 250 ms running a simple test (server side)
  • about 350 - 400 ms running the same test (client side)
  • 1.5+ seconds real world time from clicking on the play button to it finishing in VS Code.

I know its possible to get tests to run in a split second (close to that server time), because that is how fast it ran on my hackathon implementation (which used files instead of a web server). I distinctly remember the spinner not being able to complete a full rotation. That said, things are pretty fast so this might be splitting hairs. Of course, the daemon is frequently ran with the debugger, and these times balloon out to where the time savings are more significant and meaningful. Using the debugger seems to add less than half a second.

JamesHutchison added a commit that referenced this issue May 18, 2023
* Return instead of exit
* Improve client startup
* Measure server time and print it
* Reduce imports for plugin for client use case
* Cache test collection
* Add cachetools dependency
* Increment version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant