Skip to content

Make TypeDefinitionRegistry serializable#2454

Merged
bbakerman merged 1 commit into
masterfrom
make_type_definition_registry_serlialisable
Jul 15, 2021
Merged

Make TypeDefinitionRegistry serializable#2454
bbakerman merged 1 commit into
masterfrom
make_type_definition_registry_serlialisable

Conversation

@bbakerman

@bbakerman bbakerman commented Jul 14, 2021

Copy link
Copy Markdown
Member

This would allow a "parsed" SDL file to be put into an external cache say.

All of the AST nodes are serializable - why not the parsed container of them? Hence this PR.

However in practice is not that much faster than parsing really. So caching the SDL String and reparsing might be in the same ballpark and a String is a simpler contsruct to cache

The benchmark shows that serialization is faster - YMMV

Benchmark                                                                                                    Mode  Cnt   Score   Error  Units
TypeDefinitionParserVersusSerializeBenchMark.benchMarkParsing      thrpt   15  16.590 ± 0.320  ops/s
TypeDefinitionParserVersusSerializeBenchMark.benchMarkSerializing  thrpt   15  20.066 ± 0.458  ops/s

In a low CPU constrained environment, like Serverless, this might be a faster way to pre-compute part of the schema build process.

See #2452

@bbakerman bbakerman merged commit 97efeb3 into master Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants