File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,12 @@ namespace :bench do
124
124
GraphQLBenchmark . profile_to_definition
125
125
end
126
126
127
+ desc "Load schema from SDL"
128
+ task :profile_from_definition do
129
+ prepare_benchmark
130
+ GraphQLBenchmark . profile_from_definition
131
+ end
132
+
127
133
desc "Compare GraphQL-Batch and GraphQL-Dataloader"
128
134
task :profile_batch_loaders do
129
135
prepare_benchmark
Original file line number Diff line number Diff line change @@ -487,6 +487,26 @@ def self.profile_to_definition
487
487
report . pretty_print
488
488
end
489
489
490
+ def self . profile_from_definition
491
+ require "graphql/c_parser"
492
+ schema_str = SILLY_LARGE_SCHEMA . to_definition
493
+
494
+ Benchmark . ips do |x |
495
+ x . report ( "from_definition" ) { GraphQL ::Schema . from_definition ( schema_str ) }
496
+ end
497
+
498
+ result = StackProf . run ( mode : :wall , interval : 1 ) do
499
+ GraphQL ::Schema . from_definition ( schema_str )
500
+ end
501
+ StackProf ::Report . new ( result ) . print_text
502
+
503
+ report = MemoryProfiler . report do
504
+ GraphQL ::Schema . from_definition ( schema_str )
505
+ end
506
+
507
+ report . pretty_print
508
+ end
509
+
490
510
def self . profile_batch_loaders
491
511
require_relative "./batch_loading"
492
512
include BatchLoading
You can’t perform that action at this time.
0 commit comments