Selaa lähdekoodia

AK: Do not perform UTF-8 validation on Base64-encoded strings

We know we are only appending ASCII characters to the StringBuilder, so
do not bother validating the result.

This reduces the runtime of `./bin/base64 enwik8 >/dev/null` from
1.192s to 0.976s.

(enwik8 is a 100MB test file from http://mattmahoney.net/dc/enwik8.zip)
Timothy Flynn 1 vuosi sitten
vanhempi
commit
5f5b8ee9bb
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      AK/Base64.cpp

+ 1 - 1
AK/Base64.cpp

@@ -117,7 +117,7 @@ ErrorOr<String> encode_base64_impl(ReadonlyBytes input)
         TRY(output.try_append(out3));
     }
 
-    return output.to_string();
+    return output.to_string_without_validation();
 }
 
 ErrorOr<ByteBuffer> decode_base64(StringView input)