diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2015-09-10 06:07:03 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2015-09-10 06:07:03 +0000 |
commit | 477121721bd8b103d2785f5fdf3f110e54dc0e54 (patch) | |
tree | e76a7e758f6b8bc8af9fb60afdea53e5a03f4d9b /llvm/unittests/ADT/StringRefTest.cpp | |
parent | 93d5d3b5dbf9c01b60c41136482668e38e5a3806 (diff) | |
download | bcm5719-llvm-477121721bd8b103d2785f5fdf3f110e54dc0e54.tar.gz bcm5719-llvm-477121721bd8b103d2785f5fdf3f110e54dc0e54.zip |
[ADT] Add a single-character version of the small vector split routine
on StringRef. Finding and splitting on a single character is
substantially faster than doing it on even a single character StringRef
-- we immediately get to a *very* tuned memchr call this way.
Even nicer, we get to this even in a debug build, shaving 18% off the
runtime of TripleTest.Normalization, helping PR23676 some more.
llvm-svn: 247244
Diffstat (limited to 'llvm/unittests/ADT/StringRefTest.cpp')
-rw-r--r-- | llvm/unittests/ADT/StringRefTest.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/StringRefTest.cpp b/llvm/unittests/ADT/StringRefTest.cpp index d80179bd787..8af07da24ea 100644 --- a/llvm/unittests/ADT/StringRefTest.cpp +++ b/llvm/unittests/ADT/StringRefTest.cpp @@ -225,6 +225,11 @@ TEST(StringRefTest, Split2) { expected.push_back("a"); expected.push_back("b"); expected.push_back("c"); StringRef("a,,b,c").split(parts, ",", 3, false); EXPECT_TRUE(parts == expected); + + expected.clear(); parts.clear(); + expected.push_back("a"); expected.push_back("b"); expected.push_back("c"); + StringRef("a,,b,c").split(parts, ',', 3, false); + EXPECT_TRUE(parts == expected); } TEST(StringRefTest, Trim) { |