Reduce allocations in decorator
commited829cf0c68371ba77ec35417e215cb7b3bb78c7
authorThomas Wolf <thomas.wolf@paranor.ch>
Mon, 10 Jul 2017 08:43:10 +0000 (10 10:43 +0200)
committerThomas Wolf <thomas.wolf@paranor.ch>
Wed, 12 Jul 2017 20:28:01 +0000 (12 16:28 -0400)
tree7a5508e11fbc3c4ab37585e775feccf11a3e27a7
parent3b30746f0e7fe44443c7f7d00948d7628f0c4103
Reduce allocations in decorator

The GitLightweightDecorator created a new DecorationHelper for each
object to be decorated. That's not necessary; the DecorationHelper is
stateless. Use a singleton instance instead.

Also use a singleton instance ResourceState for ignored resources. For
such resources:

* we're not interested in any of the other properties,
* the default values of the other properties are fine.

While these allocations are not the cause of the slowness of updating
decorations, they add unnecessary overhead, memory usage, and pressure
on the garbage collector.

Bug: 500106
Change-Id: If80e60029c6b9f821ea4ff6f18d4cd95835fb96b
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/DecoratableResourceAdapter.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/decorators/GitLightweightDecorator.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceState.java
org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/resources/ResourceStateFactory.java