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

Change JsonFactory.builder() configuration of RecyclerPool to avoid allocation default implementation (in 3.0) #1269

Closed
cowtowncoder opened this issue Apr 20, 2024 · 0 comments
Labels

Comments

@cowtowncoder
Copy link
Member

Currently JsonFactoryBuilder takes directly RecyclerPool<BufferRecycler> for configuration (as well JsonFactory) in 2.x; and the default implementation is eagerly assigned. For the case where this is changed, we allocate default implementation only to discard it.
This is necessary since 2.x does not actually have real builder (only facade over JsonFactory).
But for 3.0 we can change things to leave pool for builder to be null, which is only changed to default implementation when one is actually needed. This avoids unnecessary allocation.

Alternatively if this didn't work we could also consider Provider style configuration (which would have other benefits with serializability); but only do that if null doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant