Loading java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoder.java +0 −12 Original line number Original line Diff line number Diff line Loading @@ -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. * Finds, as a string, the word at the address passed as an argument. * * Loading @@ -448,9 +442,6 @@ public final class BinaryDictDecoder { /* package for tests */ static WeightedString getWordAtAddress( /* package for tests */ static WeightedString getWordAtAddress( final FusionDictionaryBufferInterface buffer, final int headerSize, final int address, final FusionDictionaryBufferInterface buffer, final int headerSize, final int address, final FormatOptions formatOptions) { final FormatOptions formatOptions) { final WeightedString cachedString = wordCache.get(address); if (null != cachedString) return cachedString; final WeightedString result; final WeightedString result; final int originalPointer = buffer.position(); final int originalPointer = buffer.position(); buffer.position(address); buffer.position(address); Loading @@ -462,7 +453,6 @@ public final class BinaryDictDecoder { formatOptions); formatOptions); } } wordCache.put(address, result); buffer.position(originalPointer); buffer.position(originalPointer); return result; return result; } } Loading Loading @@ -720,8 +710,6 @@ public final class BinaryDictDecoder { public static FusionDictionary readDictionaryBinary(final BinaryDictReader reader, public static FusionDictionary readDictionaryBinary(final BinaryDictReader reader, final FusionDictionary dict) throws FileNotFoundException, IOException, final FusionDictionary dict) throws FileNotFoundException, IOException, UnsupportedFormatException { UnsupportedFormatException { // clear cache wordCache.clear(); // if the buffer has not been opened, open the buffer with bytebuffer. // if the buffer has not been opened, open the buffer with bytebuffer. if (reader.getBuffer() == null) reader.openBuffer( if (reader.getBuffer() == null) reader.openBuffer( Loading Loading
java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoder.java +0 −12 Original line number Original line Diff line number Diff line Loading @@ -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. * Finds, as a string, the word at the address passed as an argument. * * Loading @@ -448,9 +442,6 @@ public final class BinaryDictDecoder { /* package for tests */ static WeightedString getWordAtAddress( /* package for tests */ static WeightedString getWordAtAddress( final FusionDictionaryBufferInterface buffer, final int headerSize, final int address, final FusionDictionaryBufferInterface buffer, final int headerSize, final int address, final FormatOptions formatOptions) { final FormatOptions formatOptions) { final WeightedString cachedString = wordCache.get(address); if (null != cachedString) return cachedString; final WeightedString result; final WeightedString result; final int originalPointer = buffer.position(); final int originalPointer = buffer.position(); buffer.position(address); buffer.position(address); Loading @@ -462,7 +453,6 @@ public final class BinaryDictDecoder { formatOptions); formatOptions); } } wordCache.put(address, result); buffer.position(originalPointer); buffer.position(originalPointer); return result; return result; } } Loading Loading @@ -720,8 +710,6 @@ public final class BinaryDictDecoder { public static FusionDictionary readDictionaryBinary(final BinaryDictReader reader, public static FusionDictionary readDictionaryBinary(final BinaryDictReader reader, final FusionDictionary dict) throws FileNotFoundException, IOException, final FusionDictionary dict) throws FileNotFoundException, IOException, UnsupportedFormatException { UnsupportedFormatException { // clear cache wordCache.clear(); // if the buffer has not been opened, open the buffer with bytebuffer. // if the buffer has not been opened, open the buffer with bytebuffer. if (reader.getBuffer() == null) reader.openBuffer( if (reader.getBuffer() == null) reader.openBuffer( Loading