diff --git a/benchmark/0015.string/.test_prop.toml b/benchmark/0015.string/.test_prop.toml index cae7b425..1dbff7c1 100644 --- a/benchmark/0015.string/.test_prop.toml +++ b/benchmark/0015.string/.test_prop.toml @@ -12,3 +12,6 @@ ignore = true ["scan_strlike.cc"] # TODO: CI runtime failed. why? ignore = true + +["trim_right_boost.cc"] # no need to install those env in CI +ignore = true diff --git a/benchmark/0015.string/trim_right_boost.cc b/benchmark/0015.string/trim_right_boost.cc new file mode 100644 index 00000000..235294d9 --- /dev/null +++ b/benchmark/0015.string/trim_right_boost.cc @@ -0,0 +1,47 @@ +#include +#include +#include +#include +#include +#include +using namespace fast_io::io; + +int main() +{ + { + constexpr std::size_t N(40000000); + { + fast_io::timer t(u8"trim_right string"); + fast_io::string str(" ok someone like trim ok "); + for (std::size_t i{}; i != N; ++i) + { + str.push_back(' '); + str.push_back('\t'); + str.push_back('\r'); + str.push_back('\f'); + str.push_back('\v'); + str.push_back('\n'); + } + boost::algorithm::trim_right(str); + assert(str == fast_io::string(" ok someone like trim ok")); + } + } + { + constexpr std::size_t N(40000000); + { + fast_io::timer t(u8"trim_right wstring"); + fast_io::wstring str(L" ok someone like trim ok "); + for (std::size_t i{}; i != N; ++i) + { + str.push_back(u' '); + str.push_back(u'\t'); + str.push_back(u'\r'); + str.push_back(u'\f'); + str.push_back(u'\v'); + str.push_back(u'\n'); + } + boost::algorithm::trim_right(str); + assert(str == fast_io::wstring(L" ok someone like trim ok")); + } + } +}