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)
This commit is contained in:
parent
d6884a5d6f
commit
5f5b8ee9bb
Notes:
sideshowbarker
2024-07-17 04:49:48 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/5f5b8ee9bb Pull-request: https://github.com/SerenityOS/serenity/pull/23655
1 changed files with 1 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue