Skip to content

Commit d0f226d

Browse files
committed
benchmark baseline setup final.
1 parent e444ba1 commit d0f226d

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

RTLBenchmarkApp/src/BenchMark.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ namespace rtl_bench
5454

5555
for (auto _ : state)
5656
{
57-
volatile std::string forced = std::move(getMessage(g_longStr)); // ensures real move
58-
benchmark::DoNotOptimize(forced);
57+
benchmark::DoNotOptimize(getMessage(g_longStr));
5958
}
6059
}
6160

@@ -68,8 +67,7 @@ namespace rtl_bench
6867

6968
for (auto _ : state)
7069
{
71-
volatile std::string forced = std::move(getMsg(g_longStr)); // ensures real move
72-
benchmark::DoNotOptimize(forced);
70+
benchmark::DoNotOptimize(getMsg(g_longStr));
7371
}
7472
}
7573
}

RTLBenchmarkApp/src/BenchMark.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#endif
1414

1515
using argStr_t = std::string_view;
16-
using retStr_t = std::string;
16+
using retStr_t = std::string_view;
1717

1818
namespace rtl_bench
1919
{
@@ -24,7 +24,8 @@ namespace rtl_bench
2424
}
2525

2626
NOINLINE static retStr_t getMessage(argStr_t pMsg) {
27-
return retStr_t(pMsg);
27+
g_msg = pMsg;
28+
return retStr_t(g_msg->c_str());
2829
}
2930

3031
struct Node
@@ -35,7 +36,8 @@ namespace rtl_bench
3536

3637
NOINLINE retStr_t getMessage(argStr_t pMsg)
3738
{
38-
return retStr_t(pMsg);
39+
g_msg = pMsg;
40+
return retStr_t(g_msg->c_str());
3941
}
4042
};
4143

ReflectionTemplateLib/detail/inc/SetupMethod.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ namespace rtl
6969
}
7070
else {
7171

72-
_returnType&& retObj = (target.*pFunctor)(std::forward<_signature>(params)...);
72+
_returnType&& retObj = std::move((target.*pFunctor)(std::forward<_signature>(params)...));
7373
return { error::None,
7474
RObjectBuilder<_returnType>::build<alloc::Stack>(
7575
std::forward<_returnType>(retObj), isConstCastSafe)
@@ -118,7 +118,7 @@ namespace rtl
118118
};
119119
}
120120
else {
121-
_returnType&& retObj = (target.*pFunctor)(std::forward<_signature>(params)...);
121+
_returnType&& retObj = std::move((target.*pFunctor)(std::forward<_signature>(params)...));
122122
return { error::None,
123123
RObjectBuilder<_returnType>::build<alloc::Stack>(
124124
std::forward<_returnType>(retObj), isConstCastSafe)

0 commit comments

Comments
 (0)