Created
March 3, 2023 21:21
-
-
Save tenderlove/fdce1610a3eecd8426f5845391a6c373 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "benchmark/ips" | |
require "graphql/language/lexer" | |
require "graphql/language/token" | |
require "graphql/language/block_string" | |
schema = DATA.read | |
Benchmark.ips { |x| | |
x.report("graphql") { GraphQL::Language::Lexer.tokenize(schema) } | |
} | |
__END__ | |
schema { | |
query: Hello | |
} | |
""" | |
This is a directive | |
""" | |
directive @foo( | |
""" | |
It has an argument | |
""" | |
arg: Int | |
) on FIELD | |
""" | |
With an enum | |
""" | |
enum Color { | |
BLUE | |
""" | |
Not a creative color | |
""" | |
GREEN | |
RED | |
} | |
""" | |
What a great type | |
""" | |
type Hello implements I { | |
anEnum(s: S): Color | |
""" | |
And a field to boot | |
""" | |
str(i: Input): String | |
u: U | |
} | |
""" | |
An interface | |
""" | |
interface I { | |
str(i: Input): String | |
} | |
""" | |
And an Input | |
""" | |
input Input { | |
s: String | |
} | |
""" | |
A scalar | |
""" | |
scalar S | |
""" | |
And a union | |
""" | |
union U = Hello |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment