mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
optimization: faster hashCode()
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user