Bug 576264 - [performance] cache Resource's persistentProperty
Added a soft cache for PropertyBucket.
Cache can be disabled with system property
"org.eclipse.core.PropertyCache.disable=true"
Resource.getPersistentProperty(QualifiedName) is a hotspot for
application that frequently asks for persistent properties from
different Resources. An easy to reproduce example is PDEs launch dialog
for "Eclipse Application", where properties for all related projects are
read. For each project another File was (tried to) read. Depending on
the number of Projects that took significant time. In the very most
cases that property file does not even exist, so the time was just
wasted again and again.
Now the String property (if any) is remembered in Heap. For the most
typical usecase where the property does not exists that is also
remembered with an empty map. That avoids any further try to read it
from file system.
The cache is guaranteed to be thrown away before OOME happens.
Note that the maximum value string length is 2k
(PropertyManager2.MAX_VALUE_SIZE), so that the memory used is
insignificant anyway.
Caching is disabled for History Buckets (fire and forget).
Functionality (cache caches + OOME) is tested with PropertyManagerTest.
Change-Id: Ic99e8aa7579def46e00f17ea59036a5cfe8771dd
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.resources/+/185830
Tested-by: Platform Bot <platform-bot@eclipse.org>
Reviewed-by: Jörg Kubitz <jkubitz-eclipse@gmx.de>
8 files changed