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
Speed up twisted.web, part 1 of N #12133
Comments
My benchmark: import time
from twisted.web import server, static
from twisted.internet.testing import StringTransport
DATA = static.Data(b"This is a result hello hello" * 4, "text/plain")
DATA.getChild = lambda *args, **kwargs: DATA
factory = server.Site(DATA)
start = time.time()
for i in range(100_000):
transport = StringTransport()
protocol = factory.buildProtocol(None)
protocol.makeConnection(transport)
protocol.dataReceived(b"""\
GET / HTTP/1.1
Host: example.com
User-Agent: XXX
Time: XXXX
Content-Length: 0
""".replace(b"\n", b"\r\n"))
assert b"200 OK" in transport.io.getvalue()
print("requests/sec:", 100_000 / (time.time() - start)) Best run via something like |
This seems like it would be a nice, simple thing to get started with https://codspeed.io and perhaps finally replace the long-lost speed.twistedmatrix.com? |
Might do a follow-up for that, I guess. |
I have no concept of how difficult it would be, so I won't insist on it, but having something in CI first to set performance budgets so you can see progress over time would be a nice way to measure the impact of repeated changes |
OK, gonna do codspeed issue/PR next. |
Going to try do the equivalent of what I did for twisted.web client: fix a bunch of small performance issues that add up. Initial investigation suggests there will be things to fix, e.g. various overhead from deprecated code paths.
Might be a series of issues, will see.
The text was updated successfully, but these errors were encountered: