aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2012-03-22 18:17:21 -0700
committerTor Norbye <tnorbye@google.com>2012-03-22 18:17:21 -0700
commita2c463438d192ba6552b8f01e2c69bd3846e30ef (patch)
treeaffa34944f3171ebcb7787c3d83c779bc16cebd4 /eclipse
parent61684adfd7345f1a0df24bcf9176e6f528295bbb (diff)
downloadsdk-a2c463438d192ba6552b8f01e2c69bd3846e30ef.zip
sdk-a2c463438d192ba6552b8f01e2c69bd3846e30ef.tar.gz
sdk-a2c463438d192ba6552b8f01e2c69bd3846e30ef.tar.bz2
Speed up loadPublicResources()
The FrameworkResources method which loads in the public resources takes about ~500ms of the target loading time. This changeset optimizes this down to < 50ms using the following three optimizations: 1) Precompute a map from names to ResourceItems before processing the public names. Before this, it would search sequentially through the name list, which when done n times meant O(n^2); we can construct the map in O(n) and then perform n lookups in O(1) => O(n). Also, be smart about which maps we precompute names for: the ResourceType.PUBLIC and ResourceType.DECLARE_STYLEABLE types have about 2,000 items, none of which are public, so skip precomputing maps for these two. (However, keep the linear search around such that if any are exported in the future the code will work correctly. Similarly, we know "roughly" the size of the final public maps, so initialize them in the right size range such that they don't have to do any internal resize+copy operations as we insert into them. 2) In android-15 there are 1500 new <java-symbol> elements in the public xml file, which were being processed, doubling the number of exported symbols. Limit the processing to only the <public> tags. 3) Switch from DOM parsing to pull parsing. This helps since more than half the file consists of <java-symbol> elements, and we can ignore whitespace and id attributes etc, so there is much less object creation involved. Change-Id: I4761e1182b9bc0c50fe94aea7dcd9690754c7908
Diffstat (limited to 'eclipse')
-rw-r--r--eclipse/dictionary.txt2
1 files changed, 2 insertions, 0 deletions
diff --git a/eclipse/dictionary.txt b/eclipse/dictionary.txt
index dca9b23..c1640c0 100644
--- a/eclipse/dictionary.txt
+++ b/eclipse/dictionary.txt
@@ -192,6 +192,8 @@ popup
popups
pre
precompiler
+precompute
+precomputing
pref
prefs
preload