Brad Fitzpatrick 70ece8d334 Speed up Uri.getQueryParameter by allocating less.
Sample hierarchial URL, from my ContactsProvider test case:

content://com.android.contacts/data?account_name=braddroid%40gmail.com&account_type=com.google.GAIA&caller_is_syncadapter=true

Without this patch:  (fetching the "account_name" parameter)

10000 iters: 0.5293 ms average
10000 iters: 0.5119 ms average
10000 iters: 0.5158 ms average

With this patch, rewriting it to not allocate memory (no implicit
StringBuilder), but still no caching:

1) when it needs to decode something (i.e account_name above;
   allocates memory)

  50000 iters: 0.28724 ms average
  50000 iters: 0.31774 ms average
  50000 iters: 0.28764 ms average

2) when it doesn't need to decode (and thus allocate memory,
   i.e. account_type above)

  50000 iters: 0.0954 ms average
  50000 iters: 0.09124 ms average
  50000 iters: 0.09088 ms average
2009-10-26 14:46:25 -07:00
..