Unverified Commit 16933e9e authored by Donny/강동윤's avatar Donny/강동윤 Committed by GitHub

perf(turbopack): Optimize `Rope` correctly (#80335)

### What?

Utilize _cheap clone_ of `bytes::Bytes`. I made an error in the previous pull request.

### Why?

 - In the name of the performance.
 - `bytes::Bytes` is cheap to clone.
parent 4250c5b3
......@@ -550,6 +550,10 @@ impl InnerRope {
return data.into_iter().next().unwrap().into_bytes(len);
}
Err(data) => {
// If we have a single element, we can return it directly.
if let Local(bytes) = &data[0] {
return bytes.clone();
}
self.0 = data;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment