mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[indexes] skip useless byte[] allocation/copy
+ directly use byte[] subrange instead of its copy GitOrigin-RevId: be7ea5c8763e69afa1410171856bb0389f34d434
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c7bd7dab06
commit
c8a7a4ed29
@@ -268,6 +268,7 @@ internal fun capturePropagationContext(r: Runnable, forceUseContextJob : Boolean
|
||||
}
|
||||
val (childContext, childContinuation) =
|
||||
if (forceUseContextJob) createChildContextWithContextJob(r.toString())
|
||||
//TODO: do we really need .toString() here? It allocates ~6 Gb during indexing
|
||||
else createChildContext(r.toString())
|
||||
command = ContextRunnable(true, childContext, command)
|
||||
if (childContinuation != null) {
|
||||
|
||||
+9
-1
@@ -117,6 +117,14 @@ public interface DataExternalizerEx<T> {
|
||||
return new ByteArrayWriter(bytes, 0, bytes.length);
|
||||
}
|
||||
|
||||
static KnownSizeRecordWriter fromBytes(@NotNull ByteArraySequence bytes) {
|
||||
return new ByteArrayWriter(
|
||||
bytes.getInternalBuffer(),
|
||||
bytes.getOffset(),
|
||||
bytes.getLength()
|
||||
);
|
||||
}
|
||||
|
||||
static KnownSizeRecordWriter fromBytes(byte @NotNull [] bytes,
|
||||
int offset,
|
||||
int length) {
|
||||
@@ -161,7 +169,7 @@ public interface DataExternalizerEx<T> {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ByteArrayWriter[" + IOUtil.toHexString(Arrays.copyOfRange(bytes, startingOffset, startingOffset+length)) + "]";
|
||||
return "ByteArrayWriter[" + IOUtil.toHexString(Arrays.copyOfRange(bytes, startingOffset, startingOffset + length)) + "]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user