Convert NoOpValueCache#get return value to constant exception#108
Convert NoOpValueCache#get return value to constant exception#108jord1e wants to merge 1 commit into
Conversation
|
Stack traces are captured when an exception is created. Throwing the same instance will result in incorrect traces. Look at JVM classes, e.g. Or am I misunderstanding the situation? 😶 |
@kaqqao No, you aren't The thing is that the exception is discarded right after checking if the key is cached: Thus it does not matter. |
|
Thanks for this PR - this is important. It was not meant to be allocating any memory I think we can take this further. I created #109 so that it can short circuit out of the value cache which makes it faster by default |
|
No. #109 looks good, glad my profiling helped bring this issue to light. I will close this PR as it is no longer necessary. |
Describe the bug
A UnsupportedOperationException was being created on every NoOpValueCache#get call.
I tested one of my queries with some dataloaders: 100.000 query operations over three waves. The result was 700.000 UnsupportedOperationException initializations!
Imagining the unnecessary allocations at scale is astounding
JMC view:

Stacktrace:

To Reproduce
Use DataLoader+GraphQL Java with the NoOpValueCache and analyze with JMC or JFR (
jdk.JavaExceptionThrowevent)