aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2013-08-16 08:28:19 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-08-16 08:28:19 +0000
commit47bac6ebf237435faaf3913e353a6230e0299cb3 (patch)
tree6760c217065fda12b82883ac863fd40deb2d5a8c /java/src
parent21dddb1462df8f32b40365dbb27930ae6c8113b8 (diff)
parent6e26cc3f5d7f3f7d2f2f28e53bc9986d6236df79 (diff)
downloadlatinime-47bac6ebf237435faaf3913e353a6230e0299cb3.tar.gz
latinime-47bac6ebf237435faaf3913e353a6230e0299cb3.tar.xz
latinime-47bac6ebf237435faaf3913e353a6230e0299cb3.zip
Merge "Remove unnecessary caching."
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoder.java12
1 files changed, 0 insertions, 12 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoder.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoder.java
index 01cc8ac1e..046c5b5dc 100644
--- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoder.java
+++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoder.java
@@ -430,12 +430,6 @@ public final class BinaryDictDecoder {
}
}
- // The word cache here is a stopgap bandaid to help the catastrophic performance
- // of this method. Since it performs direct, unbuffered random access to the file and
- // may be called hundreds of thousands of times, the resulting performance is not
- // reasonable without some kind of cache. Thus:
- private static TreeMap<Integer, WeightedString> wordCache =
- new TreeMap<Integer, WeightedString>();
/**
* Finds, as a string, the word at the address passed as an argument.
*
@@ -448,9 +442,6 @@ public final class BinaryDictDecoder {
/* package for tests */ static WeightedString getWordAtAddress(
final FusionDictionaryBufferInterface buffer, final int headerSize, final int address,
final FormatOptions formatOptions) {
- final WeightedString cachedString = wordCache.get(address);
- if (null != cachedString) return cachedString;
-
final WeightedString result;
final int originalPointer = buffer.position();
buffer.position(address);
@@ -462,7 +453,6 @@ public final class BinaryDictDecoder {
formatOptions);
}
- wordCache.put(address, result);
buffer.position(originalPointer);
return result;
}
@@ -720,8 +710,6 @@ public final class BinaryDictDecoder {
public static FusionDictionary readDictionaryBinary(final BinaryDictReader reader,
final FusionDictionary dict) throws FileNotFoundException, IOException,
UnsupportedFormatException {
- // clear cache
- wordCache.clear();
// if the buffer has not been opened, open the buffer with bytebuffer.
if (reader.getBuffer() == null) reader.openBuffer(