feat: strip prefixes and suffixes in links (#5486)
This commit is contained in:
@@ -5,8 +5,6 @@
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#include <optional>
|
||||
|
||||
using namespace chatterino;
|
||||
|
||||
const QString INPUT = QStringLiteral(
|
||||
@@ -14,8 +12,9 @@ const QString INPUT = QStringLiteral(
|
||||
"(or 2.4.2 if its out) "
|
||||
"https://github.com/Chatterino/chatterino2/releases/tag/nightly-build "
|
||||
"AlienPls https://www.youtube.com/watch?v=ELBBiBDcWc0 "
|
||||
"127.0.3 aaaa xd 256.256.256.256 AsdQwe xd 127.0.0.1 https://. https://.be "
|
||||
"https://a http://a.b https://a.be ftp://xdd.com "
|
||||
"127.0.3 aaaa xd 256.256.256.256 AsdQwe xd 127.0.0.1 https://. "
|
||||
"*https://.be "
|
||||
"https://a: http://a.b (https://a.be) ftp://xdd.com "
|
||||
"this is a text lol . ://foo.com //aa.de :/foo.de xd.XDDDDDD ");
|
||||
|
||||
static void BM_LinkParsing(benchmark::State &state)
|
||||
@@ -24,15 +23,15 @@ static void BM_LinkParsing(benchmark::State &state)
|
||||
|
||||
// Make sure the TLDs are loaded
|
||||
{
|
||||
benchmark::DoNotOptimize(LinkParser("xd.com").result());
|
||||
benchmark::DoNotOptimize(linkparser::parse("xd.com"));
|
||||
}
|
||||
|
||||
for (auto _ : state)
|
||||
{
|
||||
for (auto word : words)
|
||||
for (const auto &word : words)
|
||||
{
|
||||
LinkParser parser(word);
|
||||
benchmark::DoNotOptimize(parser.result());
|
||||
auto parsed = linkparser::parse(word);
|
||||
benchmark::DoNotOptimize(parsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user