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

UDT* value subclasses for Flyweight object pools #13

Open
willhains opened this issue Jun 1, 2023 · 0 comments
Open

UDT* value subclasses for Flyweight object pools #13

willhains opened this issue Jun 1, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@willhains
Copy link
Owner

Currently, the UDT* value classes are subclassed by Pure* and Recyclable* classes.

The Recyclable* classes reuse existing instances, resetting their raw value on every "allocation".

Use-Case

There are use-cases where the same, small number of values are repeated many times.
In these cases, it might be better to keep a cache of previously created instances, similar to String.intern(). (And the UDTString subclass could actually intern the raw value as well.)

Proposed API

public final @Value class CityName extends FlyweightString<CityName> {...}
@willhains willhains added the enhancement New feature or request label Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant