提问人:QQ QQ 提问时间:5/15/2023 最后编辑:Anonymous robotQQ QQ 更新时间:6/11/2023 访问量:46
PyPy 比使用 tornado 的 Cpython 慢
PyPy slower than Cpython using tornado
问:
我有一个帐户服务,用于使用 jmeter 测试 pypy 和 cpython:
import tornado.ioloop
import tornado.web
import uuid
class Account(object):
def init(self):
self.accounts = {}
def create_account(self, name):
account_id = str(uuid.uuid4())
self.accounts[account_id] = name
return account_id
account_service = Account()
class AccountHandler(tornado.web.RequestHandler):
def get(self, name):
account_id = account_service.create_account(name)
self.write({"accountId": account_id})
print(account_id)
def make_app():
return tornado.web.Application([
(r"/create_account/(.*)", AccountHandler),
])
if name == "main":
app = make_app()
app.listen(8888)
tornado.ioloop.IOLoop.current().start()
Jmeter 结果(线程数 - 100,循环数 - 100):Pypy:平均毫秒 - 78 Cpython:平均 ms - 6 看起来 cpython 比 pypy 工作得更快。 那么,有人可以解释一下,这是为什么?
我希望pypy比cpython更快。
答: 暂无答案
评论