syrusakbary / promise

Ultra-performant Promise implementation in Python
MIT License
362 stars 76 forks source link

v2.3.0 Performance Regressions #82

Open qeternity opened 4 years ago

qeternity commented 4 years ago

Using Python 3.8.1 on Ubuntu 18.04 I find graphene to be 13-15% slower using 2.3.0 vs. 2.2.1 with the below simple benchmark. This is not a promises benchmark since we are not direct consumers of it, but I noticed on new services a slowdown and finally pinned it down to the updates Promise package.

import graphene
import timeit

class UserQuery(graphene.ObjectType):
    id = graphene.Int()

class Query(graphene.ObjectType):
    users = graphene.List(UserQuery)
    def resolve_users(self, info):
        return users

class User(object):
    def __init__(self, id):
        self.id = id

users = [User(index) for index in range(0, 1000)]
schema = graphene.Schema(query=Query)
print(timeit.timeit(lambda: schema.execute('{ users { id } }').data, number=1000))
qeternity commented 4 years ago

Anything? Few months old now for a significant performance regression in a low level library