Performance issue in makeSchema with schemas containing a lot of extensions#4020
Performance issue in makeSchema with schemas containing a lot of extensions#4020xuorig wants to merge 2 commits intographql-java:masterfrom
makeSchema with schemas containing a lot of extensions#4020Conversation
|
I think this PR is a good work around. However cheaper accessors is the way forward really
yeah the code today is old and crusty This idea of copying the objects should be replaced by ImmutableXX collections - we have embraced this elsewhere in the graphql code base but not here is seems. if we had immutables in place then and would be the same cost |
|
Ahh I just had a look at the code - its embraced mutability up the wazoo Hmmm immutability is now tricky because its relying on mutability when being built (versus being read) I am wary that we could make this embrace immutability and not break everyone - is the juice worth the squeeze ?? We need some new structure when its passed in as a "read only" world to say Spitballing this could be and then key code could be hanged to used here. In some ways this is what you did when you threaded the "copied" lists into the read only places Hmmmm tricky to fix systemically |
|
ok this PR is probably more systemic Now the code covered in this PR gets a |
|
That's great @bbakerman 🚀🚢 |
|
Closing in favor of #4021 |
For schemas with a large amount of object extensions,
makeSchemacan allocate a lot of memory due to the immutable nature ofTypeRegistry.*extensions().The main culprit is
src/main/java/graphql/schema/idl/ImplementingTypesChecker.javawhich repeatedly callsobjectTypeExtensionsandinterfaceTypeExtensions. (first commit)buildObjectTypeis also an issue. (second commit).First commit fix on
ImplementingTypesCheckershould make a lot of sense, but forbuildObjectType, I'd love your opinions. I can cache all kinds of extensions onBuildContext(only did object type for now, as that was our issue).Can also discuss if there should be cheaper getters on
TypeRegistry. I welcome your thoughts!