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

Optimized OgnlContext constructors, reduced collection sizes #9

Merged
merged 1 commit into from
May 17, 2015
Merged

Optimized OgnlContext constructors, reduced collection sizes #9

merged 1 commit into from
May 17, 2015

Conversation

danielfernandez
Copy link
Contributor

I've optimized the OgnlContext constructors so that:

  • The _values map object is not instantiated if not really needed. This map (which was a large one, 23 entries) was being always created, even if the OgnlContext constructor being used immediately replaced it by one of its arguments. I'm executing some thousands of OGNL expressions per second and I'm always using new OgnlContext(myOwnMap), so this meant a lot of spurious, large HashMap objects being created without any need and a waste in memory usage.
  • The _typeStack and _accessorStack objects, of type List, were being initialized to their default size which is 10, but very few OGNL expressions actually use 10 stack positions. Normally they don't go over 2 or 3. So by reducing the initial size of those collections to 3, a noticeable save in memory could be obtained under heavy loads.

@lukaszlenart
Copy link
Collaborator

Looks good, let's roll!

lukaszlenart added a commit that referenced this pull request May 17, 2015
Optimized OgnlContext constructors, reduced collection sizes
@lukaszlenart lukaszlenart merged commit b1de795 into orphan-oss:master May 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants