# HG changeset patch # User wenzelm # Date 1679834207 -7200 # Node ID dd4bb80dbc3a12c17980ac5a8f1f54a5b6aff179 # Parent 25fd62cba3477a686a97cb49c09d9d5de19da8d4 tuned performance: much faster low-level operation; diff -r 25fd62cba347 -r dd4bb80dbc3a src/Pure/General/bytes.scala --- a/src/Pure/General/bytes.scala Sun Mar 26 14:24:38 2023 +0200 +++ b/src/Pure/General/bytes.scala Sun Mar 26 14:36:47 2023 +0200 @@ -12,6 +12,7 @@ import java.nio.ByteBuffer import java.nio.channels.FileChannel import java.nio.file.StandardOpenOption +import java.util.Arrays import org.tukaani.xz import com.github.luben.zstd @@ -118,9 +119,9 @@ override def equals(that: Any): Boolean = { that match { case other: Bytes => - if (this eq other) true - else if (length != other.length) false - else (0 until length).forall(i => bytes(offset + i) == other.bytes(other.offset + i)) + this.eq(other) || + Arrays.equals(bytes, offset, offset + length, + other.bytes, other.offset, other.offset + other.length) case _ => false } }