summaryrefslogtreecommitdiffstats
path: root/dalvik
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2009-12-21 10:52:53 -0800
committerElliott Hughes <enh@google.com>2009-12-21 15:02:47 -0800
commit2e3a41defb42a97b463194d859d2d4088a600fd8 (patch)
tree67a89bce7f2450e9125b96074e0848a71ab4f451 /dalvik
parent011496fc0d73dc55c452eb1d7b60fe3c73885921 (diff)
downloadlibcore-2e3a41defb42a97b463194d859d2d4088a600fd8.zip
libcore-2e3a41defb42a97b463194d859d2d4088a600fd8.tar.gz
libcore-2e3a41defb42a97b463194d859d2d4088a600fd8.tar.bz2
Speed up the way we access ICU's locale data.
This patch makes creating a new NumberFormat or new SimpleDateFormat 2x faster. Basically, the ResourceBundle mechanism is really expensive in several ways: 1. The two-level caching is unnecessary for locale data, and expensive because it burns through a lot of temporary objects. 2. The PrivilegedAction stuff is unnecessary and expensive because it too burns quite a few temporary objects (including an ArrayList for each call; should we consider removing support for SecurityManager so we can remove this cruft from our code?). 3. The caching in most cases doesn't cache anything useful; the ResourceBundles simply forward all questions straight to native code anyway, all we're caching is an unnecessary forwarding object (in a cache where lookups cost more than just creating a new unnecessary forwarding object would cost). I've left CurrencyResourceBundle on the slow (ResourceBundle.getBundle) path because I'm not yet sure how much of that path's semantics it relies on. I still return LocaleResourceBundle instances (albeit via a much faster path) but we should fix that. The native code returns an array which ResourceBundle stuffs into a Hashtable and the calling code accesses via hash table lookups. This despite the fact that the keys are a small fixed set known in advance. We could make the native layer and the calling layer simpler and faster by using a "struct", and doing so would make the middle layer go away completely.
Diffstat (limited to 'dalvik')
0 files changed, 0 insertions, 0 deletions