Stuart McCulloch
2015-03-21 17:13:45 UTC
Recent changes to the internal dependency stack in InternalContext reduced memory consumption at the cost of overall performance (see cadabc1aa1cbe30c48a7b730c2907c82abff6336). The changes in 9be698db4a8fa560cfae23795d629b018ad009cf helped, but it's still not as good as the original implementation. One reason might be that `ArrayList.removeRange` will always trigger a call to `System.arrayCopy`, even when you're only removing a range at the end of the list.
Since the internal API needed from `DependencyStack` is minimal, I tried re-implementing it as a thin wrapper around an array. The following implementation is faster than the original (at least on my local machine) while still retaining the memory improvements.
WDYT? Note this is a bare-bones implementation, extra checks can be added as necessary.
You can view, comment on, or merge this pull request online at:
https://github.com/google/guice/pull/911
-- Commit Summary --
* Improve performance of internal DependencyStack collection
-- File Changes --
M core/src/com/google/inject/internal/InternalContext.java (35)
-- Patch Links --
https://github.com/google/guice/pull/911.patch
https://github.com/google/guice/pull/911.diff
---
Reply to this email directly or view it on GitHub:
https://github.com/google/guice/pull/911
Since the internal API needed from `DependencyStack` is minimal, I tried re-implementing it as a thin wrapper around an array. The following implementation is faster than the original (at least on my local machine) while still retaining the memory improvements.
WDYT? Note this is a bare-bones implementation, extra checks can be added as necessary.
You can view, comment on, or merge this pull request online at:
https://github.com/google/guice/pull/911
-- Commit Summary --
* Improve performance of internal DependencyStack collection
-- File Changes --
M core/src/com/google/inject/internal/InternalContext.java (35)
-- Patch Links --
https://github.com/google/guice/pull/911.patch
https://github.com/google/guice/pull/911.diff
---
Reply to this email directly or view it on GitHub:
https://github.com/google/guice/pull/911
--
You received this message because you are subscribed to the Google Groups "google-guice-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice-dev+***@googlegroups.com.
To post to this group, send email to google-guice-***@googlegroups.com.
Visit this group at http://groups.google.com/group/google-guice-dev.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "google-guice-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice-dev+***@googlegroups.com.
To post to this group, send email to google-guice-***@googlegroups.com.
Visit this group at http://groups.google.com/group/google-guice-dev.
For more options, visit https://groups.google.com/d/optout.