-
Notifications
You must be signed in to change notification settings - Fork 966
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
Improve Factories #218
Comments
But creation of these classes is really cheap. UPD it seems that creation of the stateless class is much faster than using |
The creation will be cheap; but using Humanizer on a website with many calls to localised methods will create so many objects in memory. These will be eventually GCed; but do we really need 1000s of these classes in memory? |
This was referenced Apr 17, 2014
Fixed in #243 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We have a few factories in the codebase in charge of returning an instance of a class based on the ambient culture. Here is an example of a factory:
Basically every time we call Formatter, which is quite frequent, we're creating a new instance for the Formatter/NumberToWordsConverter/Ordinalizer, and this is quite bad.
We need to change the factory to return a lazy instance instead so it's created on the first call and available from then on.
The text was updated successfully, but these errors were encountered: