Hello friends In my `schema.graphql`, I have 13 qu...
# graphql-kotlin
j
Hello friends In my
schema.graphql
, I have 13 queries and 6 mutations. graphql-kotlin takes about 3s to generate the
GraphQL
object. I don't mind on server startup, but it makes the unit tests slow. Is there something I can do to investigate & improve performance?
d
👋 3s does seem excessive but unfortunately I don't think we ever done benchmarking on how long it takes to create the schema so hard to say whether it is expected or not
j
Thanks for your answer. If there is a way to improve performance, would that be mostly in graphql-java or in graphql-kotlin?
d
reflection is pretty slow but still 3s seems pretty excessive if you ask me
how many types your schema defines?
also are you limiting the amount of packages ("supported packages" param) to scan by classgraph?
j
yes I have a number of features and everywhere I use
Copy code
supportedPackages = listOf("com.tignum.backend.features.$FEATURE$.graphql"),
I have about 60 types, including them all: outputs, inputs, enums, union interfaces
d
thats not many
have you tried running a profiler to see where the time is spent?
j
yes but I have not the least idea on how to interpret it
d
looks like our spring example app with handful of queries takes ~2s to start on my machine (also includes some overhead from spring)
j
d
It looks like most of the time is spent going through the classpath
j
Could it be that it scans for packages
com.tignum.backend.features.$FEATURE$.graphql
in all my Gradle dependencies, while it's in fact only present in my own source code?
d
might be
it is supposed to be very fast -> https://github.com/classgraph/classgraph
j
That does make a difference! From 700ms to 220m if I only scan my own code. I have 198 dependencies by the way...