andreas / ocaml-graphql-server

GraphQL servers in OCaml
MIT License
624 stars 60 forks source link

Add introspection fields during schema creation #183

Open dwwoelfel opened 4 years ago

dwwoelfel commented 4 years ago

This solves a problem we saw at OneGraph when upgrading to the latest version of ocaml-graphql-server.

Our query times increased by ~60ms on every query after upgrading. We tracked down the cause to this commit https://github.com/andreas/ocaml-graphql-server/commit/b187eaa15046e8fc01b111a8ac4791d6c92a0e3b, which calls types_of_schema on every call to execute. We have a lot of types, so it added a noticeable amount of latency.

With this change, types_of_schema is calculated only once when you construct the schema.