graphql-java icon indicating copy to clipboard operation
graphql-java copied to clipboard

Made the field definition lookup more optimised

Open bbakerman opened this issue 1 year ago • 0 comments

The field lookup code will most of the time be looking up a object type field and not a system field. So this adds a more optimised code path for that.

As seen in some memory profiling - these assertions are not cost free

Recorded Objects
Session:	graphql-java-clean [:ComplexQueryBenchmark.main()]
Time of export:	Saturday, March 2, 2024 at 4:11:45 PM Australian Eastern Daylight Time
JVM time:	01:25
 	 
Sorted by: 	Instance Count
Aggregation level: 	Classes
Liveness mode: 	Live Objects
Recording rate: 	1/10 allocations

Name													Instance Count	Size
java.util.LinkedHashMap$Entry								16,915 (12 %)	676 kB
java.util.concurrent.CompletableFuture						16,644 (12 %)	399 kB
java.lang.String											14,836 (10 %)	356 kB
java.lang.Object[ ]											5,111 (3 %)	135 kB
graphql.introspection.Introspection$$Lambda$592.154913348	 3,877 (2 %)	93,048 bytes
graphql.introspection.Introspection$$Lambda$588.1661450720	 3,855 (2 %)	61,680 bytes
com.google.common.collect.ImmutableList$Builder				3,553 (2 %)	85,272 bytes

graphql.introspection.Introspection$$Lambda$592.154913348 and graphql.introspection.Introspection$$Lambda$588.1661450720 are the assertion allocated supplier messages

So while small - there is some memory cost to assertions

bbakerman avatar Mar 03 '24 23:03 bbakerman