Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
perf(schema): use FnvHashMap for type and directive names #93
In this change set, I have chosen to apply FNV only to the type and directive names tracked by the
Here you can see how
In my (somewhat limited) benchmark, the change appears to lead to a worthwhile performance improvement.
SeaHash might have a higher throughput, but FNV is pretty much on par or better on short strings, which is the typical workload for Juniper.
I think this looks good, thanks for the improvement! I think your assumptions about hash-collisions attacks are reasonable.
Without having done any deeper performance analysis, I'd think that Juniper's biggest overhead on larger queries is running the validation passes. Having a MFU/MRU cache of parsed and validated ASTs could probably help there, or implementing Apollo's persisted queries.
Oct 8, 2017
@mhallin agreed. Coincidentally, my work on removing the lifetime parameter from the AST for purposes of introducing async could prove useful for introducing a query cache as well!
Generally though it'd be nice if Juniper was fast for all queries, regardless of how frequently they are executed :)