44
55
66def test_big_list_of_ints (benchmark ):
7- big_int_list = [x for x in range (10000 )]
7+ big_int_list = [x for x in range (5000 )]
88
99 def resolve_all_ints (root , args , context , info ):
1010 return big_int_list
@@ -25,6 +25,19 @@ def resolve_all_ints(root, args, context, info):
2525 assert result .data == {'allInts' : big_int_list }
2626
2727
28+
29+ def test_big_list_of_ints (benchmark ):
30+ big_int_list = [x for x in range (5000 )]
31+ from ..executor import complete_leaf_value
32+ # def convert_item(i):
33+ # return i
34+
35+ def convert_list ():
36+ r = []
37+ for i in big_int_list :
38+ r .append (GraphQLInt .serialize (i ))
39+ return r
40+ benchmark (convert_list )
2841def test_big_list_of_containers_with_one_field (benchmark ):
2942 Container = namedtuple ('Container' , 'x y z o' )
3043
@@ -35,7 +48,7 @@ def test_big_list_of_containers_with_one_field(benchmark):
3548 'o' : GraphQLField (GraphQLInt ),
3649 })
3750
38- big_container_list = [Container (x = x , y = x , z = x , o = x ) for x in range (10000 )]
51+ big_container_list = [Container (x = x , y = x , z = x , o = x ) for x in range (5000 )]
3952
4053 def resolve_all_containers (root , args , context , info ):
4154 return big_container_list
@@ -66,7 +79,7 @@ def test_big_list_of_containers_with_multiple_fields(benchmark):
6679 'o' : GraphQLField (GraphQLInt ),
6780 })
6881
69- big_container_list = [Container (x = x , y = x , z = x , o = x ) for x in range (10000 )]
82+ big_container_list = [Container (x = x , y = x , z = x , o = x ) for x in range (5000 )]
7083
7184 def resolve_all_containers (root , args , context , info ):
7285 return big_container_list
0 commit comments