-
-
Notifications
You must be signed in to change notification settings - Fork 388
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
hug.test.call performance issues #878
Comments
Hey there 👋 I haven't used Hug much, but could this be the same issue as falconry/falcon#1550 ? If that is the root cause, it has been fixed; however the fix is not a part of any stable release yet. |
I've noticed similar issues with the test suite run times when using |
Sorry for the complete ot, @ianthetechie I'm interested in knowing what tool(s) did you use to generate the graph? |
Sorry I haven't had a chance to test with the falcon 3.0 alpha yet but I haven't forgotten ;) @CaselIT the graph was generated by the PyCharm profiler. |
Hey Tim,
I stumbled across an issue when digging into why our unit test suite was performing poorly. I'm not sure whether this is an issue with hug or falcon, but here's the quick overview. We have a suite of around 1000 tests that we run in pytest. We noticed running times were creeping up to around 30 mins. I initially blamed CI runners and questionable database operations but dug a little deeper with a profiler and discovered that around 75% of running time was spent constructing falcon APIs, of all things...
This was, to say the least, a bit surprising. So I dug in a bit more and realized that
hug.test.call
is creating a new server every single invocation, which is to say, a few thousand invocations per test run. TL;DR, I was able to cut runtimes by about 80% by not doing this. As for what to do about it, I'd welcome your input. This may be an issue with falcon, but my gut says this really shouldn't be something hug is doing.I have hazarded a guess at the general direction of a fix, but I admit elements of this are quite hacking and I'm almost positive this isn't the right approach. The fixes may be more appropriately applied to the
server()
method, but I tried to keep my own changes as surgical as possible and relegated to the test framework. We are currently using this code internally. I would welcome your feedback on this and can open a PR with a cleaned up solution if this is on the right track.Cheers!
The text was updated successfully, but these errors were encountered: