Java objects with small memory footprint #183
AlexeyPirogov
started this conversation in
Ideas
Replies: 1 comment
-
Hello, This seems a good idea, especially in this use case, with 4000 fields in an object. I'm currently working to deliver the 2.x release. I'll give this one a try when the 2.x is ok. I'm not sure if the impact on the existing code. Étienne |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It's excellent that we can create GraphQL classes, but using instances of these classes can be memory-intensive.
In my situation, I'm dealing with Elastic Search objects that have over 4,000 fields. However, most clients only need to load a few fields, making it a perfect use case for GraphQL. The problem is that each Java object will contain null values for the unused fields.
An alternative solution is to create classes with identical getters, but with a map that stores the actual response from the GraphQL server. The getters can then retrieve the values from the map, and if a value is not present, return null or throw an exception, depending on the client's preference. This approach can help reduce memory usage by only storing the necessary fields in the object.
Beta Was this translation helpful? Give feedback.
All reactions