GithubHelp home page GithubHelp logo

Comments (5)

itamarst avatar itamarst commented on September 27, 2024 2

OK, gonna do codspeed issue/PR next.

from twisted.

itamarst avatar itamarst commented on September 27, 2024

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 hyperfine.

from twisted.

glyph avatar glyph commented on September 27, 2024

Best run via something like hyperfine.

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?

from twisted.

itamarst avatar itamarst commented on September 27, 2024

Might do a follow-up for that, I guess.

from twisted.

glyph avatar glyph commented on September 27, 2024

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

from twisted.

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.