Using variables destroys performance
See original GitHub issueQuery without variables:
{
user_news(where: {user_id: {_eq: 1}, status: {_eq: 0}}, limit: 10, order_by: {id: desc}) {
id
}
}
Throughput: 3800 req/s
Query with variables:
query($user:Int, $status: Int){
user_news(where: {user_id: {_eq: $user}, status: {_eq: $status}}, limit: 10, order_by: {id: desc}) {
id
}
}
Variables:
{
"user":1,
"status":0
}
Throughput: 980 req/s
In more complex example where I first noticed this performance drop it went from ~1500req/s to ~250req/s.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Java Destruction of Variables - Stack Overflow
Java uses a garbage collector, so unused objects are disposed of automatically. In your example you use only local variables ...
Read more >Efficiency when declaring variables - Unity Answers
Hi. I've researched for a while about the most efficient way to declare variables, and I haven't found a definitive answer.
Read more >Global vs Local variable performance - Arduino Forum
I've often read that global variables have a slight performance edge ... and destroyed faster than a global variable is assigned a value?...
Read more >Thread environment variables - IBM
If the program contains a large number of active condition variables and frequently creates and destroys condition variables, this can create higher overhead ......
Read more >CUDA C++ Programming Guide - NVIDIA Documentation Center
Performance Guidelines gives some guidance on how to achieve maximum performance. ... When a host thread calls cudaDeviceReset() , this destroys the primary ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yep, non nullable variables brought it to 90+% of non variable query performance. This should really be in documentation because it will byte a lot of people, I didn’t even know that variables could be nullable, let alone that there is big difference in performance.
The trick with with
GHCRTS
also improved performance for quite a bit, I’m surprised it’s not defaultThanks. I would leave this open as reminder