diff options
author | Tor Norbye <tnorbye@google.com> | 2012-03-21 16:42:26 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2012-03-22 14:47:15 -0700 |
commit | 6b09013b6cb0fdcb48350a60bb3ed924ac9f562d (patch) | |
tree | 8d47626f9587ed8dd23f1778bea259b91d011e1f /rule_api/src | |
parent | 8de63483eb3475488bd0958299ec1ad1d0c79f9c (diff) | |
download | sdk-6b09013b6cb0fdcb48350a60bb3ed924ac9f562d.zip sdk-6b09013b6cb0fdcb48350a60bb3ed924ac9f562d.tar.gz sdk-6b09013b6cb0fdcb48350a60bb3ed924ac9f562d.tar.bz2 |
Speed up Android Target Data loading
This changeset optimizes the handling of AttributeDescriptors during
the SDK target loading phase. From some simple benchmarks, this
speeds up target loading about 40%. (On an low-load machine, loading
two targets took on average 9.11s with standard deviation 1.86 for 13
runs; after the fix the same target loading took on average 6.359s
with standard deviation 0.944s for 17 runs -- so the speedup is 1.43).
The most important fix is to make the computation of the tooltip text
and the UI name (which performs various lowercase to uppercase
conversions, in some cases involving regular expressions, and many
string concatentations) be evaluated lazily. This is a big win since
most attributes never have their UI names or tooltips displayed, and
when they are, usually just a small number.
Since tooltips and UI names are now computed lazily from the
AttributeInfo, the constructor for the TextAttributeDescriptor and its
subclasses no longer take a UI name or tooltip; instead, there is an
explicit setter for the cases where you have a specific tooltip you
want to hardcode (as with the builtin descriptors such as the ones for
drawables).
The actual formatting method for UI names was also optimized a bit,
such as avoiding regexp replacements except for cases where they are
likely needed, preallocating a larger character buffer, etc.
Change-Id: I7004e403fcf696e18bd89a29c6cfd27b61c1e9f8
Diffstat (limited to 'rule_api/src')
0 files changed, 0 insertions, 0 deletions