Skip to content

Commit e20641b

Browse files
committed
Enable graphql benchmarks with ractor harness
1 parent 0bd2158 commit e20641b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

benchmarks/graphql/benchmark.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,21 @@
55

66
require "graphql"
77

8-
data = File.read "negotiate.gql"
8+
DATA = Ractor.make_shareable(File.read "negotiate.gql")
9+
10+
if ENV["YJIT_BENCH_RACTOR_HARNESS"]
11+
GraphQL.default_parser
12+
Ractor.make_shareable(GraphQL::Tracing::NullTrace)
13+
GraphQL::Language::Lexer.constants.each do |constant|
14+
Ractor.make_shareable(GraphQL::Language::Lexer.const_get(constant))
15+
end
16+
GraphQL::Language::Parser.constants.each do |constant|
17+
Ractor.make_shareable(GraphQL::Language::Parser.const_get(constant))
18+
end
19+
end
920

1021
run_benchmark(10) do
1122
10.times do |i|
12-
GraphQL.parse data
23+
GraphQL.parse DATA
1324
end
1425
end

0 commit comments

Comments
 (0)