minor performance tuning;
authorwenzelm
Tue, 11 Jun 2024 16:48:20 +0200
changeset 80356 8365f1e7955e
parent 80355 5a555acad203
child 80357 fe123d033e76
minor performance tuning;
src/Pure/General/bytes.scala
--- a/src/Pure/General/bytes.scala	Tue Jun 11 16:39:53 2024 +0200
+++ b/src/Pure/General/bytes.scala	Tue Jun 11 16:48:20 2024 +0200
@@ -20,14 +20,12 @@
 object Bytes {
   val empty: Bytes = new Bytes(Array[Byte](), 0, 0)
 
-  def apply(s: CharSequence): Bytes = {
-    val str = s.toString
-    if (str.isEmpty) empty
+  def apply(s: CharSequence): Bytes =
+    if (s.isEmpty) empty
     else {
-      val b = UTF8.bytes(str)
+      val b = UTF8.bytes(s.toString)
       new Bytes(b, 0, b.length)
     }
-  }
 
   def apply(a: Array[Byte]): Bytes = apply(a, 0, a.length)