@@ -17,16 +17,16 @@ fn query_type_name(b: &mut Bencher) {
1717 EmptySubscription :: < Database > :: new ( ) ,
1818 ) ;
1919
20- let doc = r#"
21- query IntrospectionQueryTypeQuery {
22- __schema {
23- queryType {
24- name
25- }
26- }
27- }"# ;
20+ // language=GraphQL
21+ let query = " query IntrospectionQueryTypeQuery {
22+ __schema {
23+ queryType {
24+ name
25+ }
26+ }
27+ }" ;
2828
29- b. iter ( || execute_sync ( doc , None , & schema, & graphql_vars ! { } , & database) ) ;
29+ b. iter ( || execute_sync ( query , None , & schema, & graphql_vars ! { } , & database) ) ;
3030}
3131
3232fn introspection_query ( b : & mut Bencher ) {
@@ -42,101 +42,9 @@ fn introspection_query(b: &mut Bencher) {
4242 EmptySubscription :: < Database > :: new ( ) ,
4343 ) ;
4444
45- let doc = r#"
46- query IntrospectionQuery {
47- __schema {
48- queryType { name }
49- mutationType { name }
50- subscriptionType { name }
51- types {
52- ...FullType
53- }
54- directives {
55- name
56- description
57- locations
58- args {
59- ...InputValue
60- }
61- }
62- }
63- }
64-
65- fragment FullType on __Type {
66- kind
67- name
68- description
69- fields(includeDeprecated: true) {
70- name
71- description
72- args {
73- ...InputValue
74- }
75- type {
76- ...TypeRef
77- }
78- isDeprecated
79- deprecationReason
80- }
81- inputFields {
82- ...InputValue
83- }
84- interfaces {
85- ...TypeRef
86- }
87- enumValues(includeDeprecated: true) {
88- name
89- description
90- isDeprecated
91- deprecationReason
92- }
93- possibleTypes {
94- ...TypeRef
95- }
96- }
97-
98- fragment InputValue on __InputValue {
99- name
100- description
101- type { ...TypeRef }
102- defaultValue
103- }
104-
105- fragment TypeRef on __Type {
106- kind
107- name
108- ofType {
109- kind
110- name
111- ofType {
112- kind
113- name
114- ofType {
115- kind
116- name
117- ofType {
118- kind
119- name
120- ofType {
121- kind
122- name
123- ofType {
124- kind
125- name
126- ofType {
127- kind
128- name
129- }
130- }
131- }
132- }
133- }
134- }
135- }
136- }
137- "# ;
45+ let query = include_str ! ( "../src/introspection/query.graphql" ) ;
13846
139- b. iter ( || execute_sync ( doc , None , & schema, & graphql_vars ! { } , & database) ) ;
47+ b. iter ( || execute_sync ( query , None , & schema, & graphql_vars ! { } , & database) ) ;
14048}
14149
14250benchmark_group ! ( queries, query_type_name, introspection_query) ;
0 commit comments