Optimized ByteString1.++
This commit is contained in:
parent
4256522fc8
commit
9076fbf268
1 changed files with 5 additions and 1 deletions
|
|
@ -142,7 +142,11 @@ object ByteString {
|
|||
|
||||
def ++(that: ByteString): ByteString = that match {
|
||||
case b: ByteString1C ⇒ ByteStrings(this, b.toByteString1)
|
||||
case b: ByteString1 ⇒ ByteStrings(this, b)
|
||||
case b: ByteString1 ⇒ {
|
||||
if ((bytes eq b.bytes) && (startIndex + length == b.startIndex))
|
||||
new ByteString1(bytes, startIndex, length + b.length)
|
||||
else ByteStrings(this, b)
|
||||
}
|
||||
case bs: ByteStrings ⇒ ByteStrings(this, bs)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue