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

Optimize empty arrays usages #1490

Merged
merged 2 commits into from
Dec 16, 2017
Merged

Conversation

hazzik
Copy link
Member

@hazzik hazzik commented Dec 15, 2017

No description provided.

Copy link
Member

@fredericDelaporte fredericDelaporte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

60 empty arrays are still there, I am finding them with pattern: \[\s*\][^{=;,)]*\{\s*\}.

Overall I think this change is innocuous, so why not. But I wonder if it has a measurable impact.

By some ways it looks like the intern string "optimization": put in common identical non-mutable instances, sharing some memory usage (and maybe even some cpu), but at the cost of freezing their memory use (they will no more be garbage collected). So if empty arrays of too many different types are cached, it may overall cause the application to consume more memory permanently.

Now in the case of array types, they do not look to me as that much numerous, that is why I am in a "why not" stance for this change.

Upd: pattern was not correct, I have adjusted it, it catches one more case.

@hazzik
Copy link
Member Author

hazzik commented Dec 15, 2017

Yeah, I've forgotten about new $T$[] {}

@fredericDelaporte
Copy link
Member

I have had a look with Frans's benchmark, no changes, same results with or without commits of this PR.

@fredericDelaporte fredericDelaporte merged commit 418d35a into nhibernate:master Dec 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants