Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions benchmark/0015.string/.test_prop.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
47 changes: 47 additions & 0 deletions benchmark/0015.string/trim_right_boost.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include <fast_io_dsal/string.h>
#include <fast_io.h>
#include <fast_io_device.h>
#include <fast_io_driver/timer.h>
#include <cassert>
#include <boost/algorithm/string.hpp>
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"));
}
}
}