aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Braun <dabraun@google.com>2013-05-10 11:42:47 -0700
committerDavid Braun <dabraun@google.com>2013-05-10 11:42:47 -0700
commitab6ea086d1bfe6387c35270d48be1a5c0567d7d3 (patch)
tree75bc20f38cce2327df16b935f25c529c63b56486 /src
parentf98ecec320d95adbed2d224d42cf96d6a88f16f3 (diff)
downloadvolley-ab6ea086d1bfe6387c35270d48be1a5c0567d7d3.tar.gz
Intern CacheHeader keys and values to avoid string duplication
We found that Volley generated about 20 strings per cached item (~9000 strings for ~440 cached items) and most of these were duplicates. This change interns the key and value strings to avoid duplication. This saved about 500kb for our scenario (440 images cached.)
Diffstat (limited to 'src')
-rw-r--r--src/com/android/volley/toolbox/DiskBasedCache.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/com/android/volley/toolbox/DiskBasedCache.java b/src/com/android/volley/toolbox/DiskBasedCache.java
index 75bf4d1..9559a02 100644
--- a/src/com/android/volley/toolbox/DiskBasedCache.java
+++ b/src/com/android/volley/toolbox/DiskBasedCache.java
@@ -456,8 +456,8 @@ public class DiskBasedCache implements Cache {
? Collections.<String, String>emptyMap()
: new HashMap<String, String>(size);
for (int i = 0; i < size; i++) {
- String key = ois.readUTF();
- String value = ois.readUTF();
+ String key = ois.readUTF().intern();
+ String value = ois.readUTF().intern();
result.put(key, value);
}
return result;