core: optimize Bytes::append_text using redefs in Text subclasses
authorAlexis Laferrière <alexis.laf@xymus.net>
Fri, 8 Sep 2017 14:06:31 +0000 (10:06 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Fri, 15 Sep 2017 12:25:57 +0000 (08:25 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/core/bytes.nit

index 41b6aa8..d53a76c 100644 (file)
@@ -453,12 +453,8 @@ class Bytes
                length += ln
        end
 
-       # Appends the bytes of `s` to `selftextextt`
-       fun append_text(s: Text) do
-               for i in s.substrings do
-                       append_ns(i.fast_cstring, i.byte_length)
-               end
-       end
+       # Appends the bytes of `str` to `self`
+       fun append_text(str: Text) do str.append_to_bytes self
 
        redef fun append_to(b) do b.append self