optimization: faster hashCode()

This commit is contained in:
Alexey Kudravtsev
2018-11-07 12:47:00 +03:00
parent e3116cc136
commit 0ee293d05d
2 changed files with 13 additions and 0 deletions
@@ -595,6 +595,11 @@ abstract class LineLayout {
this.endOffset = endOffset;
}
@Override
public int hashCode() {
return startOffset * 31 + endOffset;
}
private void ensureLayout(@NotNull EditorView view, BidiRun run, int line) {
if (isReal()) {
view.getTextLayoutCache().onChunkAccess(this);
@@ -60,6 +60,9 @@ public class CompressedAppendableFile {
static final String INCOMPLETE_CHUNK_LENGTH_FILE_EXTENSION = ".s";
private static int ourFilesCount;
private final int myCount = ourFilesCount++;
public CompressedAppendableFile(File file) {
this(file, 32768);
}
@@ -590,4 +593,9 @@ public class CompressedAppendableFile {
return buf[0] & 0xFF;
}
}
@Override
public int hashCode() {
return myCount;
}
}