Skip to content
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

feat: fastjson2 for serialization of GraphQLResponse and deserialization of GraphQLRequest #2040

Merged
merged 4 commits into from
Oct 3, 2024

Conversation

samuelAndalon
Copy link
Contributor

📝 Description

the previous integration of kotlinx-serialization represented a performance improvement when deserializing requests, however, responses are still being deserialized with jackson, recently we found that fastjson2 is the fastest serialization library for the jvm.

this PR adds an opt-in support for fastjson2 which provides an easy integration with springboot codecs, the serializer relies on the same jackson annotation, and just had to write a deserializer because of the polymorphic nature of GraphQLRequest and GraphQLReponse

benchmark results

GraphQLRequest deserialization
image

GraphQLResponse serialization
image

@samuelAndalon samuelAndalon requested review from Samjin, a team and dariuszkuc October 3, 2024 01:42
@samuelAndalon samuelAndalon merged commit cca3202 into master Oct 3, 2024
11 checks passed
@samuelAndalon samuelAndalon deleted the feat/fastjson branch October 3, 2024 19:39
samuelAndalon added a commit that referenced this pull request Oct 4, 2024
…ion of GraphQLRequest (#2040)

[the previous integration of
kotlinx-serialization](#1937)
represented a performance improvement when deserializing requests,
however, responses are still being deserialized with jackson, recently
we found that fastjson2 is the [fastest serialization library for the
jvm](https://github.com/fabienrenaud/java-json-benchmark).

this PR adds an opt-in support for fastjson2 which provides an easy
integration with springboot codecs, the serializer relies on the same
jackson annotation, and just had to write a deserializer because of the
polymorphic nature of GraphQLRequest and GraphQLReponse

GraphQLRequest deserialization
<img width="1156" alt="image"
src="https://github.com/user-attachments/assets/8a1e56a2-0d6f-4118-904a-a5d584caac19">

GraphQLResponse serialization
<img width="1161" alt="image"
src="https://github.com/user-attachments/assets/cfa6c843-50de-42e2-8f8e-7722c722b048">

---------

Co-authored-by: Samuel Vazquez <samvazquez@expediagroup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant