Skip to content

Commit

Permalink
Simplifying ContextManagers and avoid new Lists when creating or reac…
Browse files Browse the repository at this point in the history
…tivating snapshots.

This should be a significant performance improvement.

Signed-off-by: Sjoerd Talsma <[email protected]>
  • Loading branch information
sjoerdtalsma committed Nov 8, 2024
1 parent 46680b7 commit d91f37b
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private ContextManagers() {
@SuppressWarnings("rawtypes")
public static nl.talsmasoftware.context.api.ContextSnapshot createContextSnapshot() {
final long start = System.nanoTime();
final List<ContextManager> managers = ServiceCache.cached(ContextManager.class);
final List<ContextManager> managers = ServiceCache.cached(ContextManager.class); // Cached list is immutable
final Object[] values = new Object[managers.size()];

for (ListIterator<ContextManager> it = managers.listIterator(); it.hasNext(); ) {
Expand Down

0 comments on commit d91f37b

Please sign in to comment.