Skip to content

Instantly share code, notes, and snippets.

@tenderlove
Created March 3, 2023 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tenderlove/fdce1610a3eecd8426f5845391a6c373 to your computer and use it in GitHub Desktop.
Save tenderlove/fdce1610a3eecd8426f5845391a6c373 to your computer and use it in GitHub Desktop.
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