-
-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement "Field Selection Merging" validation #1084
Conversation
@ghostdogpr can't quite figure out how to run the benchmarks,
so I assume I'm missing some sbt command, but if I understand https://github.com/sbt/sbt-jmh correctly I should just call |
|
Haha my bad. I just gaze at the pretty ASCII art :D |
Ran some very quick benchmarks. Not 100% sure of how to read this, but if I read it correctly we get a 2x slowdown vs master (which I guess is expected, since it's probably the most complex validation rule). However, if I'm reading it right, adding memoization seems to derease performance (perhaps from worse JITing since we dynamically create functions, or overhead from running everything as effects). However, if we want to say true to XING we probably should keep it. memoized
without memoization (8a224d7)
master
|
The degradation is quite huge (2x slower without memoization, 20x slower with 😱). For performance sensitive paths it makes sense to use mutable variables and no effects (I did it in a few places, if you search |
Ok, I just realized I ran the validation at the wrong time (per field validation instead of once for the entire document). This improves the perf quite drastically. I setup some different benchmarks:
Plain Scala
Plain cached
ZIO Plain
ZIO Memoized
ZIO Cached
MASTER
Looking at the stdev, I think Plain Scala and Cached Scala is about the same. The latter probably performs better with deeploy complex queries. ZIO Cached is nice since it gets us stack safety, you pointed out. It does add some additional complexity though. Most of the versions are available as individual commits. But what's nice is that all of them are miles ahead of Sangria. |
This reverts commit 9a45e28.
Benchmark: Sangria:
Caliban w/o cache:
Caliban cached:
|
Part of #7. |
Still WIP, haven't added caching yet.