graphql-libgraphqlparser Build Status

Make graphql faster with libgraphqlparser. Ruby bindings to a C-level GraphQL parser.

It's faster:

~/projects/graphql-libgraphqlparser $ be ruby benchmark.rb
              user     system      total        real
Ruby      1.140000   0.010000   1.150000 (  1.161160)
C         0.000000   0.000000   0.000000 (  0.009008)
~/projects/graphql-libgraphqlparser $ be ruby benchmark.rb
              user     system      total        real
Ruby      1.180000   0.000000   1.180000 (  1.185929)
C         0.000000   0.000000   0.000000 (  0.008688)
~/projects/graphql-libgraphqlparser $ be ruby benchmark.rb
              user     system      total        real
Ruby      1.220000   0.010000   1.230000 (  1.233795)
C         0.010000   0.000000   0.010000 (  0.008584)

Installation

This gem depends on libgraphqlparser. You can install it a few ways:

  • Homebrew: brew install libgraphqlparser
  • From Source:
  wget https://github.com/graphql/libgraphqlparser/archive/v0.4.0.tar.gz
  tar -xzvf v0.4.0.tar.gz
  cd libgraphqlparser-0.4.0/ && cmake . && make && make install

Then, install this gem:

gem "graphql-libgraphqlparser"

When you require this gem, it overrides GraphQL.parse:

require "graphql/libgraphqlparser"

Todo

  • Get directives from OperationDefinitions
  • AbstractNode overrides are full of tension. Resolve that tension with GraphQL main.
  • Node #type is sometimes a String, sometimes a Node. That should always be the same.