Mirror: The spec-compliant minimum of client-side GraphQL.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add initial benchmark suite

+111
+69
benchmark/kitchen_sink.graphql
··· 1 + # Copyright (c) 2015-present, Facebook, Inc. 2 + # 3 + # This source code is licensed under the MIT license found in the 4 + # LICENSE file in the root directory of this source tree. 5 + 6 + query queryName($foo: ComplexType, $site: Site = MOBILE) @onQuery { 7 + whoever123is: node(id: [123, 456]) { 8 + id 9 + ... on User @onInlineFragment { 10 + field2 { 11 + id 12 + alias: field1(first: 10, after: $foo) @include(if: $foo) { 13 + id 14 + ...frag @onFragmentSpread 15 + } 16 + } 17 + } 18 + ... @skip(unless: $foo) { 19 + id 20 + } 21 + ... { 22 + id 23 + } 24 + } 25 + } 26 + 27 + mutation likeStory @onMutation { 28 + like(story: 123) @onField { 29 + story { 30 + id @onField 31 + } 32 + } 33 + } 34 + 35 + subscription StoryLikeSubscription($input: StoryLikeSubscribeInput) 36 + @onSubscription { 37 + storyLikeSubscribe(input: $input) { 38 + story { 39 + likers { 40 + count 41 + } 42 + likeSentence { 43 + text 44 + } 45 + } 46 + } 47 + } 48 + 49 + fragment frag on Friend @onFragmentDefinition { 50 + foo( 51 + size: $site 52 + bar: 12 53 + obj: { 54 + key: "value" 55 + block: """ 56 + block string uses \""" 57 + """ 58 + } 59 + ) 60 + } 61 + 62 + query teeny { 63 + unnamed(truthy: true, falsey: false, nullish: null) 64 + query 65 + } 66 + 67 + query tiny { 68 + __typename 69 + }
+14
benchmark/package.json
··· 1 + { 2 + "name": "benchmark", 3 + "private": true, 4 + "version": "1.0.0", 5 + "main": "suite.js", 6 + "license": "MIT", 7 + "scripts": { 8 + "start": "NODE_ENV=production benchr suite.js" 9 + }, 10 + "dependencies": { 11 + "benchr": "4.3.0", 12 + "graphql": "^16.6.0" 13 + } 14 + }
+26
benchmark/suite.js
··· 1 + const fs = require('fs'); 2 + const graphqlWeb = require('..'); 3 + const graphql = require('graphql'); 4 + 5 + const kitchenSink = fs.readFileSync('./kitchen_sink.graphql', { encoding: 'utf8' }); 6 + const document = graphql.parse(kitchenSink, { noLocation: true }); 7 + 8 + suite('parse kitchen sink query', () => { 9 + benchmark('0no-co/graphql.web', () => { 10 + graphqlWeb.parse(kitchenSink); 11 + }); 12 + 13 + benchmark('graphql', () => { 14 + graphql.parse(kitchenSink, { noLocation: true }); 15 + }); 16 + }); 17 + 18 + suite('print kitchen sink query', () => { 19 + benchmark('0no-co/graphql.web', () => { 20 + graphqlWeb.print(document); 21 + }); 22 + 23 + benchmark('graphql', () => { 24 + graphql.print(document); 25 + }); 26 + });
+2
pnpm-workspace.yaml
··· 1 + packages: 2 + - 'benchmark'