diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 68304f36..fbb3a500 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,11 +2,11 @@ name: RTL Build on: push: - branches: [ release ] + branches: [ release, develop ] paths-ignore: - '**/*.md' pull_request: - branches: [ release ] + branches: [ release, develop ] paths-ignore: - '**/*.md' workflow_dispatch: diff --git a/CMakeLists.txt b/CMakeLists.txt index 0500cf1d..5c611b4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,9 +6,9 @@ project(CxxReflectionProject) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin") # Add the subdirectories +add_subdirectory(ReflectionTemplateLib) add_subdirectory(CxxTestRegistration) -add_subdirectory(RTLTestRunApp) -add_subdirectory(RTLBenchmarkApp) add_subdirectory(CxxTestProps) add_subdirectory(CxxTestUtils) -add_subdirectory(ReflectionTemplateLib) \ No newline at end of file +add_subdirectory(RTLTestRunApp) +add_subdirectory(RTLBenchmarkApp) \ No newline at end of file diff --git a/CxxTestProps/inc/Complex.h b/CxxTestProps/inc/Complex.h index 40441aa2..808a270f 100644 --- a/CxxTestProps/inc/Complex.h +++ b/CxxTestProps/inc/Complex.h @@ -2,14 +2,9 @@ #include +// C-style/free-functions. std::string getComplexNumAsString(); -std::string reverseString(); - -std::string reverseString(std::string pStr); - -std::string reverseString(const char* pStr); - namespace complex { double getMagnitude(); diff --git a/CxxTestProps/inc/StringOps.h b/CxxTestProps/inc/StringOps.h new file mode 100644 index 00000000..3fe0a062 --- /dev/null +++ b/CxxTestProps/inc/StringOps.h @@ -0,0 +1,160 @@ +#pragma once + +#include + +std::string reverseString(); + +std::string reverseString(const char* pStr); + +std::string reverseString(std::string pStr); // (1) by value + +std::string reverseString(std::string& pStr); // (2) lvalue ref + +std::string reverseString(const std::string& pStr); // (3) const lvalue ref + +std::string reverseString(std::string&& pStr); // (4) rvalue ref + +std::string reverseString(std::string* pStr); // (5) pointer + +std::string reverseString(const std::string* pStr); // (6) pointer to const + +std::string revStrConstRefArg(const std::string_view& pStr); + +std::string revStrNonConstRefArg(std::string_view& pStr); + +std::string revStrRValueRefArg(std::string_view&& pStr); + +std::string revStrOverloadValRef(std::string_view pStr); + +std::string revStrOverloadValRef(std::string_view& pStr); + +std::string revStrOverloadValCRef(std::string_view pStr); + +std::string revStrOverloadValCRef(const std::string_view& pStr); + +std::string revStrOverloadRefAndCRef(std::string_view& pStr); + +std::string revStrOverloadRefAndCRef(const std::string_view& pStr); + + +// 'StrMute' - String-Mutable, all methods are non-const. +struct StrMute +{ + constexpr static const char* struct_ = "StrMute"; + + std::string reverseString(); + + std::string reverseString(const char* pStr); + + std::string reverseString(std::string pStr); // (1) by value + + std::string reverseString(std::string& pStr); // (2) lvalue ref + + std::string reverseString(const std::string& pStr); // (3) const lvalue ref + + std::string reverseString(std::string&& pStr); // (4) rvalue ref + + std::string reverseString(std::string* pStr); // (5) pointer + + std::string reverseString(const std::string* pStr); // (6) pointer to const + + std::string revStrConstRefArg(const std::string_view& pStr); + + std::string revStrNonConstRefArg(std::string_view& pStr); + + std::string revStrRValueRefArg(std::string_view&& pStr); + + std::string revStrOverloadValRef(std::string_view pStr); + + std::string revStrOverloadValRef(std::string_view& pStr); + + std::string revStrOverloadValCRef(std::string_view pStr); + + std::string revStrOverloadValCRef(const std::string_view& pStr); + + std::string revStrOverloadRefAndCRef(std::string_view& pStr); + + std::string revStrOverloadRefAndCRef(const std::string_view& pStr); +}; + + +// 'StrConst' - String-Const, all methods are const. +struct StrConst +{ + constexpr static const char* struct_ = "StrConst"; + + std::string reverseString() const; + + std::string reverseString(const char* pStr) const; + + std::string reverseString(std::string pStr) const; // (1) by value + + std::string reverseString(std::string& pStr) const; // (2) lvalue ref + + std::string reverseString(const std::string& pStr) const; // (3) const lvalue ref + + std::string reverseString(std::string&& pStr) const; // (4) rvalue ref + + std::string reverseString(std::string* pStr) const; // (5) pointer + + std::string reverseString(const std::string* pStr) const; // (6) pointer to const + + std::string revStrConstRefArg(const std::string_view& pStr) const; + + std::string revStrNonConstRefArg(std::string_view& pStr) const; + + std::string revStrRValueRefArg(std::string_view&& pStr) const; + + std::string revStrOverloadValRef(std::string_view pStr) const; + + std::string revStrOverloadValRef(std::string_view& pStr) const; + + std::string revStrOverloadValCRef(std::string_view pStr) const; + + std::string revStrOverloadValCRef(const std::string_view& pStr) const; + + std::string revStrOverloadRefAndCRef(std::string_view& pStr) const; + + std::string revStrOverloadRefAndCRef(const std::string_view& pStr) const; +}; + + +// 'StrStatic' - String-Static, all methods are static. +struct StrStatic +{ + constexpr static const char* struct_ = "StrStatic"; + + static std::string reverseString(); + + static std::string reverseString(const char* pStr); + + static std::string reverseString(std::string pStr); // (1) by value + + static std::string reverseString(std::string& pStr); // (2) lvalue ref + + static std::string reverseString(const std::string& pStr); // (3) const lvalue ref + + static std::string reverseString(std::string&& pStr); // (4) rvalue ref + + static std::string reverseString(std::string* pStr); // (5) pointer + + static std::string reverseString(const std::string* pStr); // (6) pointer to const + + static std::string revStrConstRefArg(const std::string_view& pStr); + + static std::string revStrNonConstRefArg(std::string_view& pStr); + + static std::string revStrRValueRefArg(std::string_view&& pStr); + + static std::string revStrOverloadValRef(std::string_view pStr); + + static std::string revStrOverloadValRef(std::string_view& pStr); + + static std::string revStrOverloadValCRef(std::string_view pStr); + + static std::string revStrOverloadValCRef(const std::string_view& pStr); + + static std::string revStrOverloadRefAndCRef(std::string_view& pStr); + + static std::string revStrOverloadRefAndCRef(const std::string_view& pStr); +}; \ No newline at end of file diff --git a/CxxTestProps/src/CMakeLists.txt b/CxxTestProps/src/CMakeLists.txt index 56de8e88..c8f47d7f 100644 --- a/CxxTestProps/src/CMakeLists.txt +++ b/CxxTestProps/src/CMakeLists.txt @@ -1,20 +1,22 @@ # Create a variable containing the source files for your target set(LOCAL_SOURCES "${CMAKE_CURRENT_LIST_DIR}/Book.cpp" - "${CMAKE_CURRENT_LIST_DIR}/Complex.cpp" "${CMAKE_CURRENT_LIST_DIR}/Date.cpp" "${CMAKE_CURRENT_LIST_DIR}/Person.cpp" "${CMAKE_CURRENT_LIST_DIR}/Animal.cpp" "${CMAKE_CURRENT_LIST_DIR}/Library.cpp" + "${CMAKE_CURRENT_LIST_DIR}/Complex.cpp" + "${CMAKE_CURRENT_LIST_DIR}/StringOps.cpp" ) SET(LOCAL_HEADERS "${PROJECT_SOURCE_DIR}/inc/Book.h" - "${PROJECT_SOURCE_DIR}/inc/Complex.h" "${PROJECT_SOURCE_DIR}/inc/Date.h" "${PROJECT_SOURCE_DIR}/inc/Animal.h" "${PROJECT_SOURCE_DIR}/inc/Person.h" "${PROJECT_SOURCE_DIR}/inc/Library.h" + "${PROJECT_SOURCE_DIR}/inc/Complex.h" + "${PROJECT_SOURCE_DIR}/inc/StringOps.h" ) # Add any additional source files if needed diff --git a/CxxTestProps/src/Complex.cpp b/CxxTestProps/src/Complex.cpp index 9c9315e4..d70b4ad3 100644 --- a/CxxTestProps/src/Complex.cpp +++ b/CxxTestProps/src/Complex.cpp @@ -1,36 +1,8 @@ #include -#include #include "Complex.h" -namespace test_utils { - - const char* REV_STR_VOID_RET = "func_reverseString(void)->[return_str]"; -} - -std::string reverseString() -{ - return test_utils::REV_STR_VOID_RET; -} - - -std::string reverseString(std::string pStr) -{ - std::string retStr = pStr; - std::reverse(retStr.begin(), retStr.end()); - return retStr; -} - - -std::string reverseString(const char* pStr) -{ - std::string retStr = pStr; - std::reverse(retStr.begin(), retStr.end()); - return retStr; -} - - namespace complex { static double g_imgNumber; @@ -51,8 +23,7 @@ namespace complex } } - std::string getComplexNumAsString() { return std::to_string(complex::g_realNumber) + "i" + (std::to_string(complex::g_imgNumber)); -} +} \ No newline at end of file diff --git a/CxxTestProps/src/Complex.h b/CxxTestProps/src/Complex.h new file mode 100644 index 00000000..e69de29b diff --git a/CxxTestProps/src/StringOps.cpp b/CxxTestProps/src/StringOps.cpp new file mode 100644 index 00000000..b5f85634 --- /dev/null +++ b/CxxTestProps/src/StringOps.cpp @@ -0,0 +1,571 @@ + +#include + +#include "StringOps.h" + +namespace test_utils { + + const char* SUFFIX_void = "_void"; + const char* SUFFIX_const = "_const"; + const char* SUFFIX_static = "_static"; + const char* SUFFIX_const_char_ptr = "_const_char_*"; + + const char* SUFFIX_std_string = "_std::string"; + + const char* SUFFIX_std_string_ptr = "_std::string*"; + const char* SUFFIX_std_string_cptr = "_const_std::string*"; + + const char* SUFFIX_std_string_lvref = "_std::string&"; + const char* SUFFIX_std_string_clvref = "_const_std::string&"; + + const char* SUFFIX_std_string_rvref = "_std::string&&"; + + const char* REV_STR_VOID_RET = "func_reverseString(void)->[return_str]"; + + const char* SUFFIX_std_string_view = "_std::string_view"; + const char* SUFFIX_std_string_view_lvref = "_std::string_view&"; + const char* SUFFIX_std_string_view_rvref = "_std::string_view&&"; + const char* SUFFIX_std_string_view_clvref = "_const_std::string_view&"; +} + +using namespace test_utils; + +std::string reverseString() +{ + return std::string(REV_STR_VOID_RET) + SUFFIX_void; +} + + +std::string reverseString(const char* pStr) +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_const_char_ptr; +} + + +std::string reverseString(std::string pStr) +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string; +} + + +std::string reverseString(std::string& pStr) +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_lvref; +} + + +std::string reverseString(std::string&& pStr) +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_rvref; +} + + +std::string reverseString(const std::string& pStr) +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_clvref; +} + + +std::string reverseString(std::string* pStr) +{ + std::string retStr = *pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_ptr; +} + + +std::string reverseString(const std::string* pStr) +{ + std::string retStr = *pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_cptr; +} + + +std::string revStrConstRefArg(const std::string_view& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_clvref; +} + + +std::string revStrRValueRefArg(std::string_view&& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_rvref; +} + + +std::string revStrNonConstRefArg(std::string_view& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_lvref; +} + + +std::string revStrOverloadValCRef(std::string_view pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view; +} + + +std::string revStrOverloadValCRef(const std::string_view& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_clvref; +} + + +std::string revStrOverloadValRef(std::string_view pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view; +} + + +std::string revStrOverloadValRef(std::string_view& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_lvref; +} + + +std::string revStrOverloadRefAndCRef(std::string_view& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_lvref; +} + + +std::string revStrOverloadRefAndCRef(const std::string_view& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_clvref; +} + +//---------------------------StrMute-------------------------------- + +std::string StrMute::reverseString() +{ + return std::string(REV_STR_VOID_RET) + SUFFIX_void; +} + + +std::string StrMute::reverseString(const char* pStr) +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_const_char_ptr; +} + + +std::string StrMute::reverseString(std::string pStr) +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string; +} + + +std::string StrMute::reverseString(std::string& pStr) +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_lvref; +} + + +std::string StrMute::reverseString(std::string&& pStr) +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_rvref; +} + + +std::string StrMute::reverseString(const std::string& pStr) +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_clvref; +} + + +std::string StrMute::reverseString(std::string* pStr) +{ + std::string retStr = *pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_ptr; +} + + +std::string StrMute::reverseString(const std::string* pStr) +{ + std::string retStr = *pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_cptr; +} + + +std::string StrMute::revStrConstRefArg(const std::string_view& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_clvref; +} + + +std::string StrMute::revStrRValueRefArg(std::string_view&& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_rvref; +} + + +std::string StrMute::revStrNonConstRefArg(std::string_view& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_lvref; +} + + +std::string StrMute::revStrOverloadValCRef(std::string_view pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view; +} + + +std::string StrMute::revStrOverloadValCRef(const std::string_view& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_clvref; +} + + +std::string StrMute::revStrOverloadValRef(std::string_view pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view; +} + + +std::string StrMute::revStrOverloadValRef(std::string_view& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_lvref; +} + + +std::string StrMute::revStrOverloadRefAndCRef(std::string_view& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_lvref; +} + + +std::string StrMute::revStrOverloadRefAndCRef(const std::string_view& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_clvref; +} + + +//---------------------------StrConst-------------------------------- + +std::string StrConst::reverseString() const +{ + return std::string(REV_STR_VOID_RET) + SUFFIX_void + SUFFIX_const; +} + + +std::string StrConst::reverseString(const char* pStr) const +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_const_char_ptr + SUFFIX_const; +} + + +std::string StrConst::reverseString(std::string pStr) const +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string + SUFFIX_const; +} + + +std::string StrConst::reverseString(std::string& pStr) const +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_lvref + SUFFIX_const; +} + + +std::string StrConst::reverseString(std::string&& pStr) const +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_rvref + SUFFIX_const; +} + + +std::string StrConst::reverseString(const std::string& pStr) const +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_clvref + SUFFIX_const; +} + + +std::string StrConst::reverseString(std::string* pStr) const +{ + std::string retStr = *pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_ptr + SUFFIX_const; +} + + +std::string StrConst::reverseString(const std::string* pStr) const +{ + std::string retStr = *pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_cptr + SUFFIX_const; +} + + +std::string StrConst::revStrConstRefArg(const std::string_view& pStr) const +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_clvref + SUFFIX_const; +} + + +std::string StrConst::revStrRValueRefArg(std::string_view&& pStr) const +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_rvref + SUFFIX_const; +} + + +std::string StrConst::revStrNonConstRefArg(std::string_view& pStr) const +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_lvref + SUFFIX_const; +} + + +std::string StrConst::revStrOverloadValCRef(std::string_view pStr) const +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view + SUFFIX_const; +} + + +std::string StrConst::revStrOverloadValCRef(const std::string_view& pStr) const +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_clvref + SUFFIX_const; +} + + +std::string StrConst::revStrOverloadValRef(std::string_view pStr) const +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view + SUFFIX_const; +} + + +std::string StrConst::revStrOverloadValRef(std::string_view& pStr) const +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_lvref + SUFFIX_const; +} + + +std::string StrConst::revStrOverloadRefAndCRef(std::string_view& pStr) const +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_lvref + SUFFIX_const; +} + + +std::string StrConst::revStrOverloadRefAndCRef(const std::string_view& pStr) const +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_clvref + SUFFIX_const; +} + + +//---------------------------StrStatic-------------------------------- + +std::string StrStatic::reverseString() +{ + return std::string(REV_STR_VOID_RET) + SUFFIX_void + SUFFIX_static; +} + + +std::string StrStatic::reverseString(const char* pStr) +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_const_char_ptr + SUFFIX_static; +} + + +std::string StrStatic::reverseString(std::string pStr) +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string + SUFFIX_static; +} + + +std::string StrStatic::reverseString(std::string& pStr) +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_lvref + SUFFIX_static; +} + + +std::string StrStatic::reverseString(std::string&& pStr) +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_rvref + SUFFIX_static; +} + + +std::string StrStatic::reverseString(const std::string& pStr) +{ + std::string retStr = pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_clvref + SUFFIX_static; +} + + +std::string StrStatic::reverseString(std::string* pStr) +{ + std::string retStr = *pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_ptr + SUFFIX_static; +} + + +std::string StrStatic::reverseString(const std::string* pStr) +{ + std::string retStr = *pStr; + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_cptr + SUFFIX_static; +} + + +std::string StrStatic::revStrConstRefArg(const std::string_view& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_clvref + SUFFIX_static; +} + + +std::string StrStatic::revStrRValueRefArg(std::string_view&& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_rvref + SUFFIX_static; +} + + +std::string StrStatic::revStrNonConstRefArg(std::string_view& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_lvref + SUFFIX_static; +} + + +std::string StrStatic::revStrOverloadValCRef(std::string_view pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view + SUFFIX_static; +} + + +std::string StrStatic::revStrOverloadValCRef(const std::string_view& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_clvref + SUFFIX_static; +} + + +std::string StrStatic::revStrOverloadValRef(std::string_view pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view + SUFFIX_static; +} + + +std::string StrStatic::revStrOverloadValRef(std::string_view& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_lvref + SUFFIX_static; +} + + +std::string StrStatic::revStrOverloadRefAndCRef(std::string_view& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_lvref + SUFFIX_static; +} + + +std::string StrStatic::revStrOverloadRefAndCRef(const std::string_view& pStr) +{ + std::string retStr(pStr); + std::reverse(retStr.begin(), retStr.end()); + return retStr + SUFFIX_std_string_view_clvref + SUFFIX_static; +} \ No newline at end of file diff --git a/CxxTestRegistration/CMakeLists.txt b/CxxTestRegistration/CMakeLists.txt index 96b0a6a3..64ce7ca9 100644 --- a/CxxTestRegistration/CMakeLists.txt +++ b/CxxTestRegistration/CMakeLists.txt @@ -15,11 +15,9 @@ ADD_LIBRARY(${PROJECT_NAME} STATIC "") INCLUDE_DIRECTORIES(inc) INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/CxxTestUtils/inc") INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/CxxTestProps/inc") -INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/ReflectionTemplateLib/common") -INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/ReflectionTemplateLib/detail/inc") -INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/ReflectionTemplateLib/access/inc") -INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/ReflectionTemplateLib/builder/inc") +INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/ReflectionTemplateLib/rtl/inc") +TARGET_LINK_LIBRARIES(${CXX_LIB_NAME} CxxTestProps) TARGET_LINK_LIBRARIES(${CXX_LIB_NAME} ReflectionTemplateLib) # Add the source directory diff --git a/CxxTestRegistration/inc/Registration.h b/CxxTestRegistration/inc/Registration.h new file mode 100644 index 00000000..fb819625 --- /dev/null +++ b/CxxTestRegistration/inc/Registration.h @@ -0,0 +1,59 @@ +#pragma once + +#include + +namespace rtl { + class Function; +} + +namespace test_mirror +{ + extern void registerPodStdTypes(std::vector&); + + extern void registerTypeComplex(std::vector&); + + extern void registerTypeDate(std::vector&); + + extern void registerTypeEvent(std::vector&); + + extern void registerTypeCalender(std::vector&); + + extern void registerTypePerson(std::vector&); + + extern void registerTypeBook(std::vector&); + + extern void registerTypeLibrary(std::vector&); + + extern void registerTypeAnimal(std::vector&); + + extern void registerTypeStringFuncs(std::vector&); + + extern void registerTypeStringMute(std::vector&); + + extern void registerTypeStringConst(std::vector&); + + extern void registerTypeStringStatic(std::vector&); + +//--------------------------------------------------------------------------------- + extern void addTypeIdPodStd(std::unordered_map&); + + extern void addTypeIdDate(std::unordered_map&); + + extern void addTypeIdEvent(std::unordered_map&); + + extern void addTypeIdCalender(std::unordered_map&); + + extern void addTypeIdPerson(std::unordered_map&); + + extern void addTypeIdBook(std::unordered_map&); + + extern void addTypeIdLibrary(std::unordered_map&); + + extern void addTypeIdAnimal(std::unordered_map&); + + extern void addTypeIdStringMute(std::unordered_map&); + + extern void addTypeIdStringConst(std::unordered_map&); + + extern void addTypeIdStringStatic(std::unordered_map&); +} \ No newline at end of file diff --git a/CxxTestRegistration/inc/TestMirrorProvider.h b/CxxTestRegistration/inc/TestMirrorProvider.h index 42072a54..596f3a00 100644 --- a/CxxTestRegistration/inc/TestMirrorProvider.h +++ b/CxxTestRegistration/inc/TestMirrorProvider.h @@ -1,31 +1,15 @@ #pragma once -#include "RTLibInterface.h" +namespace rtl { + class CxxMirror; +} namespace test_mirror { - struct cxx - { - static const rtl::CxxMirror& mirror(); - }; - + struct cxx { - // Optional setup: do this if you prefer to access your registered types by unique 'ID', not by string. - struct reflected_id { - - static std::size_t date; - static std::size_t book; - static std::size_t event; - static std::size_t animal; - static std::size_t person; - static std::size_t library; - static std::size_t calender; - - static std::size_t char_t; - static std::size_t int_t; - static std::size_t std_string; - static std::size_t std_string_view; + static const rtl::CxxMirror& mirror(); - static const std::size_t getRecordIdFor(const std::string& pRecordName); + static const std::size_t reflected_id(const std::string& pRecordName); }; } \ No newline at end of file diff --git a/CxxTestRegistration/src/AnimalRegistration.cpp b/CxxTestRegistration/src/AnimalRegistration.cpp new file mode 100644 index 00000000..1918070c --- /dev/null +++ b/CxxTestRegistration/src/AnimalRegistration.cpp @@ -0,0 +1,87 @@ + +#include + +#include "Animal.h" +#include "Registration.h" +#include "TestUtilsAnimal.h" + +using namespace test_utils; + +namespace test_mirror +{ + void addTypeIdAnimal(std::unordered_map& id) + { + id.insert(std::make_pair(animal::class_, rtl::detail::TypeId::get())); + } + + void registerTypeAnimal(std::vector& fns) + { + // class 'Animal', methods & constructors. + fns.push_back(rtl::type().record(animal::class_) + .build()); + + fns.push_back(rtl::type().member() + .constructor() + .build()); //overloaded constructor. + + fns.push_back(rtl::type().member() + .method(animal::str_setFamilyName) + .build(&Animal::setFamilyName)); //unique method, no overloads. + + // Unique const-method, no overloads. + fns.push_back(rtl::type().member() + .methodConst(animal::str_getFamilyName) + .build(&Animal::getFamilyName)); + + // Overloaded method, taking const-ref as argument. + fns.push_back(rtl::type().member() + .method(animal::str_setAnimalName) + .build(&Animal::setAnimalName)); + + // Static method, taking const-ref as argument. + fns.push_back(rtl::type().member() + .methodStatic(animal::str_updateZooKeeper) + .build(&Animal::updateZooKeeper)); + +#if defined(__GNUC__) && !defined(__clang__) +/* + GCC here fails to automatically resolve the correct overloaded functor + when both a lvalue reference and an rvalue overload exist. + To disambiguate, explicitly cast the member function pointer, e.g.: + + static_cast(&Animal::setAnimalName) +*/ + fns.push_back(rtl::type().member() + .method(animal::str_setAnimalName) + .build(static_cast(&Animal::setAnimalName))); //overloaded method, taking non-const lvalue reference as argument. + + fns.push_back(rtl::type().member() + .method(animal::str_setAnimalName) + .build(static_cast(&Animal::setAnimalName))); //overloaded method, taking rvalue reference as argument. + + fns.push_back(rtl::type().member() + .methodStatic(animal::str_updateZooKeeper) + .build(static_cast(&Animal::updateZooKeeper))); //static method, taking non-const lvalue reference as argument. + + fns.push_back(rtl::type().member() + .methodStatic(animal::str_updateZooKeeper) + .build(static_cast(&Animal::updateZooKeeper))); //static method, taking rvalue reference as argument. +#else + fns.push_back(rtl::type().member() + .method(animal::str_setAnimalName) + .build(&Animal::setAnimalName)); //overloaded method, taking non-const lvalue reference as argument. + + fns.push_back(rtl::type().member() + .method(animal::str_setAnimalName) + .build(&Animal::setAnimalName)); //overloaded method, taking rvalue reference as argument. + + fns.push_back(rtl::type().member() + .methodStatic(animal::str_updateZooKeeper) + .build(&Animal::updateZooKeeper)); //static method, taking non-const lvalue reference as argument. + + fns.push_back(rtl::type().member() + .methodStatic(animal::str_updateZooKeeper) + .build(&Animal::updateZooKeeper)); //static method, taking rvalue reference as argument. +#endif + } +} \ No newline at end of file diff --git a/CxxTestRegistration/src/BookRegistration.cpp b/CxxTestRegistration/src/BookRegistration.cpp new file mode 100644 index 00000000..515c4e0d --- /dev/null +++ b/CxxTestRegistration/src/BookRegistration.cpp @@ -0,0 +1,65 @@ + +#include + +#include "Book.h" +#include "Registration.h" +#include "TestUtilsBook.h" + +using namespace test_utils; + +namespace test_mirror +{ + void addTypeIdBook(std::unordered_map& id) + { + id.insert(std::make_pair(book::class_, rtl::detail::TypeId::get())); + } + + void registerTypeBook(std::vector& fns) + { + // class 'Book', methods & constructors. + // Registering default constructor. + fns.push_back(rtl::type().record(book::class_) + .build()); + + // Registering overloaded constructor, signature must be specified as template parameter. + fns.push_back(rtl::type().member() + .constructor() + .build()); + + // Unique methods, no overloads. + fns.push_back(rtl::type().member() + .method(book::str_setAuthor) + .build(&Book::setAuthor)); + + // Unique method, taking 'std::string' & 'const std::string&' as argument, auto deduced via function-pointer. + fns.push_back(rtl::type().member() + .method(book::str_addPreface) + .build(&Book::addPreface)); + + // Furthur registrations of unique-menthods, signature auto-deduced via function pointer. + fns.push_back(rtl::type().member() + .method(book::str_setDescription) + .build(&Book::setDescription)); + + fns.push_back(rtl::type().member() + .method(book::str_getPublishedOn) + .build(&Book::getPublishedOn)); + + fns.push_back(rtl::type().member() + .method(book::str_addCopyrightTag) + .build(&Book::addCopyrightTag)); + + // Registering overloaded methods, signature must be specified as template params since other overloads exists, else compiler error. + fns.push_back(rtl::type().member() + .method(book::str_updateBookInfo) + .build(&Book::updateBookInfo)); + + fns.push_back(rtl::type().member() + .method(book::str_updateBookInfo) + .build(&Book::updateBookInfo)); + + fns.push_back(rtl::type().member() + .method(book::str_updateBookInfo) + .build(&Book::updateBookInfo)); + } +} \ No newline at end of file diff --git a/CxxTestRegistration/src/CMakeLists.txt b/CxxTestRegistration/src/CMakeLists.txt index 4592f47c..614bae82 100644 --- a/CxxTestRegistration/src/CMakeLists.txt +++ b/CxxTestRegistration/src/CMakeLists.txt @@ -5,16 +5,26 @@ project(CxxTestRegistration) # Create a variable containing the source files for your target set(LOCAL_SOURCES + "${CMAKE_CURRENT_LIST_DIR}/AnimalRegistration.cpp" + "${CMAKE_CURRENT_LIST_DIR}/BookRegistration.cpp" + "${CMAKE_CURRENT_LIST_DIR}/CalenderRegistration.cpp" + "${CMAKE_CURRENT_LIST_DIR}/ComplexRegistration.cpp" + "${CMAKE_CURRENT_LIST_DIR}/DateRegistration.cpp" + "${CMAKE_CURRENT_LIST_DIR}/EventRegistration.cpp" + "${CMAKE_CURRENT_LIST_DIR}/LibraryRegistration.cpp" + "${CMAKE_CURRENT_LIST_DIR}/PersonRegistration.cpp" + "${CMAKE_CURRENT_LIST_DIR}/PodStdRegistration.cpp" + "${CMAKE_CURRENT_LIST_DIR}/StrConstRegistration.cpp" + "${CMAKE_CURRENT_LIST_DIR}/StrDerivedRegistration.cpp" + "${CMAKE_CURRENT_LIST_DIR}/StrFuncsRegistration.cpp" + "${CMAKE_CURRENT_LIST_DIR}/StrMuteRegistration.cpp" + "${CMAKE_CURRENT_LIST_DIR}/StrStaticRegistration.cpp" "${CMAKE_CURRENT_LIST_DIR}/TestMirrorProvider.cpp" ) SET(LOCAL_HEADERS + "${PROJECT_SOURCE_DIR}/inc/Registration.h" "${PROJECT_SOURCE_DIR}/inc/TestMirrorProvider.h" - "${CMAKE_SOURCE_DIR}/CxxTestProps/inc/Book.h" - "${CMAKE_SOURCE_DIR}/CxxTestProps/inc/Complex.h" - "${CMAKE_SOURCE_DIR}/CxxTestProps/inc/Date.h" - "${CMAKE_SOURCE_DIR}/CxxTestProps/inc/Person.h" - "${CMAKE_SOURCE_DIR}/CxxTestProps/inc/Animal.h" ) # Add any additional source files if needed diff --git a/CxxTestRegistration/src/CalenderRegistration.cpp b/CxxTestRegistration/src/CalenderRegistration.cpp new file mode 100644 index 00000000..854833c3 --- /dev/null +++ b/CxxTestRegistration/src/CalenderRegistration.cpp @@ -0,0 +1,47 @@ + +#include + +#include "Registration.h" + +#include "Date.h" +#include "TestUtilsDate.h" + +using namespace test_utils; + +namespace test_mirror +{ + void addTypeIdCalender(std::unordered_map& id) + { + id.insert(std::make_pair(calender::struct_, rtl::detail::TypeId::get())); + } + + void registerTypeCalender(std::vector& fns) + { + // Registring static-method, 'methodStatic()' function must be used. compiler error otherwise. + fns.push_back(rtl::type().member() + .methodStatic(calender::str_create) + .build(&nsdate::Calender::create)); + + // Registring unique methods of class Calender, no overloads. + fns.push_back(rtl::type().member() + .method(calender::str_getTheEvent) + .build(&nsdate::Calender::getTheEvent)); + + fns.push_back(rtl::type().member() + .method(calender::str_getTheDate) + .build(&nsdate::Calender::getTheDate)); + + fns.push_back(rtl::type().member() + .method(calender::str_getSavedEvent) + .build(&nsdate::Calender::getSavedEvent)); + + fns.push_back(rtl::type().member() + .method(calender::str_getSavedDate) + .build(&nsdate::Calender::getSavedDate)); + + // class Calender, registering after the methods. (order doesn't matter) + fns.push_back(rtl::type().ns(date::ns) + .record(calender::struct_) + .build()); + } +} \ No newline at end of file diff --git a/CxxTestRegistration/src/ComplexRegistration.cpp b/CxxTestRegistration/src/ComplexRegistration.cpp new file mode 100644 index 00000000..074905de --- /dev/null +++ b/CxxTestRegistration/src/ComplexRegistration.cpp @@ -0,0 +1,33 @@ + +#include + +#include "Complex.h" +#include "Registration.h" +#include "GlobalTestUtils.h" + +using namespace test_utils; + +namespace test_mirror +{ + void registerTypeComplex(std::vector& fns) + { + // Unique function, no overloads, no need to specify signature as template parameters. + fns.push_back(rtl::type().function(str_getComplexNumAsString) + .build(getComplexNumAsString)); + + /* Grouping functions under a namespace, which is optional. they can be registered without it as well. + but if registered under namspace, then to retrieve it from CxxMirror object, namespace name must be passed, + e.g. cxx::mirror().getFunction("namespace_name", "function_name") & cxx::mirror().getRecord("namespace_name", "record_name") */ + fns.push_back(rtl::type().ns(str_complex) + .function(str_setReal) + .build(complex::setReal)); + + fns.push_back(rtl::type().ns(str_complex) + .function(str_setImaginary) + .build(complex::setImaginary)); + + fns.push_back(rtl::type().ns(str_complex) + .function(str_getMagnitude) + .build(complex::getMagnitude)); + } +} \ No newline at end of file diff --git a/CxxTestRegistration/src/DateRegistration.cpp b/CxxTestRegistration/src/DateRegistration.cpp new file mode 100644 index 00000000..d581684e --- /dev/null +++ b/CxxTestRegistration/src/DateRegistration.cpp @@ -0,0 +1,45 @@ + +#include + +#include "Date.h" +#include "Registration.h" +#include "TestUtilsDate.h" + +using namespace test_utils; + +namespace test_mirror +{ + void addTypeIdDate(std::unordered_map& id) + { + id.insert(std::make_pair(date::struct_, rtl::detail::TypeId::get())); + } + + void registerTypeDate(std::vector& fns) + { + // Constructors registration, class/struct name and type must be passed 'record("NAME")'. + // Registers default constructor with implicit registration of destructor & copy-constructor. + fns.push_back(rtl::type().ns(date::ns) + .record(date::struct_) + .build()); + + // Overloaded constructor, taking 'string' as argument, signature must be specified as template parameter. + fns.push_back(rtl::type().member() + .constructor() + .build()); + + // Again, register an overloaded constructor with diffeent signature. + fns.push_back(rtl::type().member() + .constructor() + .build()); + + // Registring, Unique method, no overloads. Taking param 'std::string', auto deduced via function-pointer. + fns.push_back(rtl::type().member() + .method(date::str_updateDate) + .build(&nsdate::Date::updateDate)); + + // Registring const-method, 'methodConst()' function must be used. compiler error otherwise. + fns.push_back(rtl::type().member() + .methodConst(date::str_getAsString) + .build(&nsdate::Date::getAsString)); + } +} \ No newline at end of file diff --git a/CxxTestRegistration/src/EventRegistration.cpp b/CxxTestRegistration/src/EventRegistration.cpp new file mode 100644 index 00000000..7f70bc83 --- /dev/null +++ b/CxxTestRegistration/src/EventRegistration.cpp @@ -0,0 +1,29 @@ + +#include + +#include "Date.h" +#include "Registration.h" +#include "TestUtilsDate.h" + +using namespace test_utils; + +namespace test_mirror +{ + void addTypeIdEvent(std::unordered_map& id) + { + id.insert(std::make_pair(event::struct_, rtl::detail::TypeId::get())); + } + + void registerTypeEvent(std::vector& fns) + { + // Registering 'Event' for reflection; instance creation via reflection fails since its default constructor is private or deleted. + // At least one member must be registered for RTL to recognize the type. be it property, member-function or constructor. + fns.push_back(rtl::type().ns(event::ns) + .record(event::struct_) + .build()); + + fns.push_back(rtl::type().member() + .method(event::str_reset) + .build(&nsdate::Event::reset)); + } +} \ No newline at end of file diff --git a/CxxTestRegistration/src/LibraryRegistration.cpp b/CxxTestRegistration/src/LibraryRegistration.cpp new file mode 100644 index 00000000..5b26a82b --- /dev/null +++ b/CxxTestRegistration/src/LibraryRegistration.cpp @@ -0,0 +1,35 @@ + +#include + +#include "Book.h" +#include "Library.h" +#include "Registration.h" +#include "TestUtilsBook.h" + +using namespace test_utils; + +namespace test_mirror +{ + void addTypeIdLibrary(std::unordered_map& id) + { + id.insert(std::make_pair(library::class_, rtl::detail::TypeId::get())); + } + + void registerTypeLibrary(std::vector& fns) + { + // Registering Library's constructor. Stack allocation (rtl::alloc::Stack) will fail since its copy constructor is deleted + // and its required by 'std::any' to store its object via copy-construction. But instance on heap (rtl::alloc::HEAP) can be + // constructed since, in that case, 'std::any' stores only the poiner which does not requires copy constructor to be called. + fns.push_back(rtl::type().record(library::class_) + .build()); + + // Registring static-method, 'methodStatic()' function must be used. compiler error otherwise. + fns.push_back(rtl::type().member() + .methodStatic(library::str_addBook) + .build(&Library::addBook)); + + fns.push_back(rtl::type().member() + .methodStatic(library::str_getBookByTitle) + .build(&Library::getBookByTitle)); + } +} \ No newline at end of file diff --git a/CxxTestRegistration/src/PersonRegistration.cpp b/CxxTestRegistration/src/PersonRegistration.cpp new file mode 100644 index 00000000..954a5f08 --- /dev/null +++ b/CxxTestRegistration/src/PersonRegistration.cpp @@ -0,0 +1,77 @@ + +#include + +#include "Person.h" +#include "Registration.h" +#include "TestUtilsPerson.h" + +using namespace test_utils; + +namespace test_mirror +{ + void addTypeIdPerson(std::unordered_map& id) + { + id.insert(std::make_pair(person::class_, rtl::detail::TypeId::get())); + } + + void registerTypePerson(std::vector& fns) + { + // class 'Person', methods & constructors. + fns.push_back(rtl::type().record(person::class_) + .build()); + + fns.push_back(rtl::type().member() + .constructor() + .build()); + + fns.push_back(rtl::type().member() + .methodStatic(person::str_createPtr) + .build(&Person::createPtr)); + + fns.push_back(rtl::type().member() + .method(person::str_updateAddress) + .build(&Person::updateAddress)); + + fns.push_back(rtl::type().member() + .method(person::str_updateAddress) + .build(&Person::updateAddress)); + + fns.push_back(rtl::type().member() + .method(person::str_getFirstName) + .build(&Person::getFirstName)); + + // Registring const-method, 'methodConst()' function must be used. compiler error otherwise. + fns.push_back(rtl::type().member() + .methodConst(person::str_updateLastName) + .build(&Person::updateLastName)); + + // Registring const-method overload, non-const overloaded method already registered above. + fns.push_back(rtl::type().member() + .methodConst(person::str_updateAddress) + .build(&Person::updateAddress)); + + fns.push_back(rtl::type().member() + .methodConst(person::str_updateAddress) + .build(&Person::updateAddress)); + + fns.push_back(rtl::type().member() + .methodStatic(person::str_getDefaults) + .build(&Person::getDefaults)); + + fns.push_back(rtl::type().member() + .methodStatic(person::str_createConst) + .build(&Person::createConst)); + + fns.push_back(rtl::type().member() + .methodStatic(person::str_getProfile) + .build(&Person::getProfile)); + + fns.push_back(rtl::type().member() + .methodStatic(person::str_getProfile) + .build(&Person::getProfile)); + + fns.push_back(rtl::type().member() + .methodStatic(person::str_getProfile) + .build(&Person::getProfile)); + } +} \ No newline at end of file diff --git a/CxxTestRegistration/src/PodStdRegistration.cpp b/CxxTestRegistration/src/PodStdRegistration.cpp new file mode 100644 index 00000000..c18cd704 --- /dev/null +++ b/CxxTestRegistration/src/PodStdRegistration.cpp @@ -0,0 +1,68 @@ + +#include + +#include "Registration.h" + +namespace test_mirror +{ + void addTypeIdPodStd(std::unordered_map& id) + { + id.insert(std::make_pair("int", rtl::detail::TypeId::get())); + id.insert(std::make_pair("char", rtl::detail::TypeId::get())); + id.insert(std::make_pair("string", rtl::detail::TypeId::get())); + id.insert(std::make_pair("string_view", rtl::detail::TypeId::get())); + } + + void registerPodStdTypes(std::vector& fns) + { + // Registering int. + fns.push_back(rtl::type().record("int") + .build()); + + // Registering type 'int' again, ignored & emits- + // [WARNING] Multiple registrations of the same type detected. + fns.push_back(rtl::type().record("int") + .build()); + + // Registering type 'void' again, but with different name. ignored & emits- + // [WARNING] Multiple registrations of the same type detected. + fns.push_back(rtl::type().record("ccint") + .build()); + + // Registering pod, reflecting- constructor, copy-constructor & destructor. + fns.push_back(rtl::type().record("char") + .build()); + + fns.push_back(rtl::type().ns("std") + .record("string_view") + .build()); + + // Registers std::string class + fns.push_back(rtl::type().member() + .methodConst("empty") + .build(&std::string::empty)); + + /* Attempting to register the same type(`std::string`) again under a different name. + * RTL will ignore this duplicate registration and retain the first one. Emits a warning on the console: + * "[WARNING] Multiple registrations of the same type with different names detected." + */ fns.push_back(rtl::type().member() + .methodConst("empty") + .build(&std::string::empty)); + + fns.push_back(rtl::type().ns("std") + .record("string") + .build()); + + /* Attempting to register std::string_view, but the provided member function pointer belongs to std::string. + * RTL will ignore this registration. Emits a warning on the console: + * "[WARNING] Member function pointer does not belong to the class being registered!" + */ fns.push_back(rtl::type().member() + .methodConst("empty") + .build(&std::string::empty)); + + // Finally, register std::string_view with correct member-function-pointer + fns.push_back(rtl::type().member() + .methodConst("empty") + .build(&std::string_view::empty)); + } +} \ No newline at end of file diff --git a/CxxTestRegistration/src/StrConstRegistration.cpp b/CxxTestRegistration/src/StrConstRegistration.cpp new file mode 100644 index 00000000..98141331 --- /dev/null +++ b/CxxTestRegistration/src/StrConstRegistration.cpp @@ -0,0 +1,113 @@ +#include + +#include "StringOps.h" +#include "Registration.h" +#include "GlobalTestUtils.h" + +using namespace test_utils; + +namespace test_mirror +{ + void addTypeIdStringConst(std::unordered_map& id) + { + id.insert(std::make_pair(StrConst::struct_, rtl::detail::TypeId::get())); + } + + void registerTypeStringConst(std::vector& fns) + { + fns.push_back(rtl::type().record(StrConst::struct_) + .build()); + + // Function taking no arguments. '' must be specified if other overload exists else not needed. compiler error otherwise. + fns.push_back(rtl::type().member() + .methodConst(str_reverseString) + .build(&StrConst::reverseString)); + + // Overloaded function, takes 'string' arguments. '' must be specified as template parameter. + fns.push_back(rtl::type().member() + .methodConst(str_reverseString) + .build(&StrConst::reverseString)); + + // Overloaded function, takes 'const char*' arguments. + fns.push_back(rtl::type().member() + .methodConst(str_reverseString) + .build(&StrConst::reverseString)); + + // numereous other overloads. + #if defined(__GNUC__) && !defined(__clang__) + /* + GCC here fails to automatically resolve the correct overloaded functor + when both a lvalue reference and an rvalue overload exist. + To disambiguate, explicitly cast the function pointer, e.g.: + + static_cast(reverseString) + */ + fns.push_back(rtl::type().member() + .methodConst(str_reverseString) + .build(static_cast(&StrConst::reverseString))); + + fns.push_back(rtl::type().member() + .methodConst(str_reverseString) + .build(static_cast(&StrConst::reverseString))); + + fns.push_back(rtl::type().member() + .methodConst(str_reverseString) + .build(static_cast(&StrConst::reverseString))); +#else + fns.push_back(rtl::type().member() + .methodConst(str_reverseString) + .build(&StrConst::reverseString)); + + fns.push_back(rtl::type().member() + .methodConst(str_reverseString) + .build(&StrConst::reverseString)); + + fns.push_back(rtl::type().member() + .methodConst(str_reverseString) + .build(&StrConst::reverseString)); +#endif + fns.push_back(rtl::type().member() + .methodConst(str_reverseString) + .build(&StrConst::reverseString)); + + fns.push_back(rtl::type().member() + .methodConst(str_reverseString) + .build(&StrConst::reverseString)); + + fns.push_back(rtl::type().member() + .methodConst(str_revStrNonConstRefArg) + .build(&StrConst::revStrNonConstRefArg)); + + fns.push_back(rtl::type().member() + .methodConst(str_revStrRValueRefArg) + .build(&StrConst::revStrRValueRefArg)); + + fns.push_back(rtl::type().member() + .methodConst(str_revStrConstRefArg) + .build(&StrConst::revStrConstRefArg)); + + fns.push_back(rtl::type().member() + .methodConst(str_revStrOverloadValRef) + .build(&StrConst::revStrOverloadValRef)); + + fns.push_back(rtl::type().member() + .methodConst(str_revStrOverloadValRef) + .build(&StrConst::revStrOverloadValRef)); + + fns.push_back(rtl::type().member() + .methodConst(str_revStrOverloadValCRef) + .build(&StrConst::revStrOverloadValCRef)); + + fns.push_back(rtl::type().member() + .methodConst(str_revStrOverloadValCRef) + .build(&StrConst::revStrOverloadValCRef)); + + fns.push_back(rtl::type().member() + .methodConst(str_revStrOverloadValRefAndCRef) + .build(&StrConst::revStrOverloadRefAndCRef)); + + fns.push_back(rtl::type().member() + .methodConst(str_revStrOverloadValRefAndCRef) + .build(&StrConst::revStrOverloadRefAndCRef)); + } +} \ No newline at end of file diff --git a/CxxTestRegistration/src/StrDerivedRegistration.cpp b/CxxTestRegistration/src/StrDerivedRegistration.cpp new file mode 100644 index 00000000..e69de29b diff --git a/CxxTestRegistration/src/StrFuncsRegistration.cpp b/CxxTestRegistration/src/StrFuncsRegistration.cpp new file mode 100644 index 00000000..0bc77b12 --- /dev/null +++ b/CxxTestRegistration/src/StrFuncsRegistration.cpp @@ -0,0 +1,85 @@ + +#include + +#include "StringOps.h" +#include "Registration.h" +#include "GlobalTestUtils.h" + +using namespace test_utils; + +namespace test_mirror +{ + void registerTypeStringFuncs(std::vector& fns) + { + // Function taking no arguments. '' must be specified if other overload exists else not needed. compiler error otherwise. + fns.push_back(rtl::type().function(str_reverseString) + .build(reverseString)); + + // Overloaded function, takes 'string' arguments. '' must be specified as template parameter. + fns.push_back(rtl::type().function(str_reverseString) + .build(reverseString)); + + // Overloaded function, takes 'const char*' arguments. + fns.push_back(rtl::type().function(str_reverseString) + .build(reverseString)); + // numereous other overloads. + #if defined(__GNUC__) && !defined(__clang__) +/* + GCC here fails to automatically resolve the correct overloaded functor + when both a lvalue reference and an rvalue overload exist. + To disambiguate, explicitly cast the function pointer, e.g.: + + static_cast(reverseString) +*/ + fns.push_back(rtl::type().function(str_reverseString) + .build(static_cast(reverseString))); + + fns.push_back(rtl::type().function(str_reverseString) + .build(static_cast(reverseString))); + + fns.push_back(rtl::type().function(str_reverseString) + .build(static_cast(reverseString))); +#else + fns.push_back(rtl::type().function(str_reverseString) + .build(reverseString)); + + fns.push_back(rtl::type().function(str_reverseString) + .build(reverseString)); + + fns.push_back(rtl::type().function(str_reverseString) + .build(reverseString)); +#endif + fns.push_back(rtl::type().function(str_reverseString) + .build(reverseString)); + + fns.push_back(rtl::type().function(str_reverseString) + .build(reverseString)); + + fns.push_back(rtl::type().function(str_revStrNonConstRefArg) + .build(revStrNonConstRefArg)); + + fns.push_back(rtl::type().function(str_revStrRValueRefArg) + .build(revStrRValueRefArg)); + + fns.push_back(rtl::type().function(str_revStrConstRefArg) + .build(revStrConstRefArg)); + + fns.push_back(rtl::type().function(str_revStrOverloadValRef) + .build(revStrOverloadValRef)); + + fns.push_back(rtl::type().function(str_revStrOverloadValRef) + .build(revStrOverloadValRef)); + + fns.push_back(rtl::type().function(str_revStrOverloadValCRef) + .build(revStrOverloadValCRef)); + + fns.push_back(rtl::type().function(str_revStrOverloadValCRef) + .build(revStrOverloadValCRef)); + + fns.push_back(rtl::type().function(str_revStrOverloadValRefAndCRef) + .build(revStrOverloadRefAndCRef)); + + fns.push_back(rtl::type().function(str_revStrOverloadValRefAndCRef) + .build(revStrOverloadRefAndCRef)); + } +} \ No newline at end of file diff --git a/CxxTestRegistration/src/StrMuteRegistration.cpp b/CxxTestRegistration/src/StrMuteRegistration.cpp new file mode 100644 index 00000000..ece0aea7 --- /dev/null +++ b/CxxTestRegistration/src/StrMuteRegistration.cpp @@ -0,0 +1,114 @@ + +#include + +#include "StringOps.h" +#include "Registration.h" +#include "GlobalTestUtils.h" + +using namespace test_utils; + +namespace test_mirror +{ + void addTypeIdStringMute(std::unordered_map& id) + { + id.insert(std::make_pair(StrMute::struct_, rtl::detail::TypeId::get())); + } + + void registerTypeStringMute(std::vector& fns) + { + fns.push_back(rtl::type().record(StrMute::struct_) + .build()); + + // Function taking no arguments. '' must be specified if other overload exists else not needed. compiler error otherwise. + fns.push_back(rtl::type().member() + .method(str_reverseString) + .build(&StrMute::reverseString)); + + // Overloaded function, takes 'string' arguments. '' must be specified as template parameter. + fns.push_back(rtl::type().member() + .method(str_reverseString) + .build(&StrMute::reverseString)); + + // Overloaded function, takes 'const char*' arguments. + fns.push_back(rtl::type().member() + .method(str_reverseString) + .build(&StrMute::reverseString)); + + // numereous other overloads. + #if defined(__GNUC__) && !defined(__clang__) + /* + GCC here fails to automatically resolve the correct overloaded functor + when both a lvalue reference and an rvalue overload exist. + To disambiguate, explicitly cast the function pointer, e.g.: + + static_cast(reverseString) + */ + fns.push_back(rtl::type().member() + .method(str_reverseString) + .build(static_cast(&StrMute::reverseString))); + + fns.push_back(rtl::type().member() + .method(str_reverseString) + .build(static_cast(&StrMute::reverseString))); + + fns.push_back(rtl::type().member() + .method(str_reverseString) + .build(static_cast(&StrMute::reverseString))); +#else + fns.push_back(rtl::type().member() + .method(str_reverseString) + .build(&StrMute::reverseString)); + + fns.push_back(rtl::type().member() + .method(str_reverseString) + .build(&StrMute::reverseString)); + + fns.push_back(rtl::type().member() + .method(str_reverseString) + .build(&StrMute::reverseString)); +#endif + fns.push_back(rtl::type().member() + .method(str_reverseString) + .build(&StrMute::reverseString)); + + fns.push_back(rtl::type().member() + .method(str_reverseString) + .build(&StrMute::reverseString)); + + fns.push_back(rtl::type().member() + .method(str_revStrNonConstRefArg) + .build(&StrMute::revStrNonConstRefArg)); + + fns.push_back(rtl::type().member() + .method(str_revStrRValueRefArg) + .build(&StrMute::revStrRValueRefArg)); + + fns.push_back(rtl::type().member() + .method(str_revStrConstRefArg) + .build(&StrMute::revStrConstRefArg)); + + fns.push_back(rtl::type().member() + .method(str_revStrOverloadValRef) + .build(&StrMute::revStrOverloadValRef)); + + fns.push_back(rtl::type().member() + .method(str_revStrOverloadValRef) + .build(&StrMute::revStrOverloadValRef)); + + fns.push_back(rtl::type().member() + .method(str_revStrOverloadValCRef) + .build(&StrMute::revStrOverloadValCRef)); + + fns.push_back(rtl::type().member() + .method(str_revStrOverloadValCRef) + .build(&StrMute::revStrOverloadValCRef)); + + fns.push_back(rtl::type().member() + .method(str_revStrOverloadValRefAndCRef) + .build(&StrMute::revStrOverloadRefAndCRef)); + + fns.push_back(rtl::type().member() + .method(str_revStrOverloadValRefAndCRef) + .build(&StrMute::revStrOverloadRefAndCRef)); + } +} \ No newline at end of file diff --git a/CxxTestRegistration/src/StrStaticRegistration.cpp b/CxxTestRegistration/src/StrStaticRegistration.cpp new file mode 100644 index 00000000..a09863f9 --- /dev/null +++ b/CxxTestRegistration/src/StrStaticRegistration.cpp @@ -0,0 +1,113 @@ +#include + +#include "StringOps.h" +#include "Registration.h" +#include "GlobalTestUtils.h" + +using namespace test_utils; + +namespace test_mirror +{ + void addTypeIdStringStatic(std::unordered_map& id) + { + id.insert(std::make_pair(StrStatic::struct_, rtl::detail::TypeId::get())); + } + + void registerTypeStringStatic(std::vector& fns) + { + fns.push_back(rtl::type().record(StrStatic::struct_) + .build()); + + // Function taking no arguments. '' must be specified if other overload exists else not needed. compiler error otherwise. + fns.push_back(rtl::type().member() + .methodStatic(str_reverseString) + .build(&StrStatic::reverseString)); + + // Overloaded function, takes 'string' arguments. '' must be specified as template parameter. + fns.push_back(rtl::type().member() + .methodStatic(str_reverseString) + .build(&StrStatic::reverseString)); + + // Overloaded function, takes 'const char*' arguments. + fns.push_back(rtl::type().member() + .methodStatic(str_reverseString) + .build(&StrStatic::reverseString)); + + // numereous other overloads. + #if defined(__GNUC__) && !defined(__clang__) + /* + GCC here fails to automatically resolve the correct overloaded functor + when both a lvalue reference and an rvalue overload exist. + To disambiguate, explicitly cast the function pointer, e.g.: + + static_cast(reverseString) + */ + fns.push_back(rtl::type().member() + .methodStatic(str_reverseString) + .build(static_cast(&StrStatic::reverseString))); + + fns.push_back(rtl::type().member() + .methodStatic(str_reverseString) + .build(static_cast(&StrStatic::reverseString))); + + fns.push_back(rtl::type().member() + .methodStatic(str_reverseString) + .build(static_cast(&StrStatic::reverseString))); +#else + fns.push_back(rtl::type().member() + .methodStatic(str_reverseString) + .build(&StrStatic::reverseString)); + + fns.push_back(rtl::type().member() + .methodStatic(str_reverseString) + .build(&StrStatic::reverseString)); + + fns.push_back(rtl::type().member() + .methodStatic(str_reverseString) + .build(&StrStatic::reverseString)); +#endif + fns.push_back(rtl::type().member() + .methodStatic(str_reverseString) + .build(&StrStatic::reverseString)); + + fns.push_back(rtl::type().member() + .methodStatic(str_reverseString) + .build(&StrStatic::reverseString)); + + fns.push_back(rtl::type().member() + .methodStatic(str_revStrNonConstRefArg) + .build(&StrStatic::revStrNonConstRefArg)); + + fns.push_back(rtl::type().member() + .methodStatic(str_revStrRValueRefArg) + .build(&StrStatic::revStrRValueRefArg)); + + fns.push_back(rtl::type().member() + .methodStatic(str_revStrConstRefArg) + .build(&StrStatic::revStrConstRefArg)); + + fns.push_back(rtl::type().member() + .methodStatic(str_revStrOverloadValRef) + .build(&StrStatic::revStrOverloadValRef)); + + fns.push_back(rtl::type().member() + .methodStatic(str_revStrOverloadValRef) + .build(&StrStatic::revStrOverloadValRef)); + + fns.push_back(rtl::type().member() + .methodStatic(str_revStrOverloadValCRef) + .build(&StrStatic::revStrOverloadValCRef)); + + fns.push_back(rtl::type().member() + .methodStatic(str_revStrOverloadValCRef) + .build(&StrStatic::revStrOverloadValCRef)); + + fns.push_back(rtl::type().member() + .methodStatic(str_revStrOverloadValRefAndCRef) + .build(&StrStatic::revStrOverloadRefAndCRef)); + + fns.push_back(rtl::type().member() + .methodStatic(str_revStrOverloadValRefAndCRef) + .build(&StrStatic::revStrOverloadRefAndCRef)); + } +} \ No newline at end of file diff --git a/CxxTestRegistration/src/TestMirrorProvider.cpp b/CxxTestRegistration/src/TestMirrorProvider.cpp index db44c78e..d80c0374 100644 --- a/CxxTestRegistration/src/TestMirrorProvider.cpp +++ b/CxxTestRegistration/src/TestMirrorProvider.cpp @@ -2,242 +2,40 @@ #include #include +#include + #include "TestMirrorProvider.h" +#include "Registration.h" #include "CxxMirrorToJson.h" -#include "GlobalTestUtils.h" - -//User defined types to be reflected. -#include "Date.h" -#include "Book.h" -#include "Person.h" -#include "Complex.h" -#include "Animal.h" -#include "Library.h" - -/* -TestUtils, provides the interface to test/compare reflected type objects with actual objects (created via strict typing) -without exposing the actual type objects to "CxxReflectionTests" project.*/ -#include "TestUtilsBook.h" -#include "TestUtilsDate.h" -#include "TestUtilsPerson.h" -#include "TestUtilsAnimal.h" - - -using namespace std; -using namespace test_utils; namespace test_mirror { const rtl::CxxMirror& cxx::mirror() { - static auto cxx_mirror = rtl::CxxMirror({ - - /* --------------------------------- - Registering pod & few STL types. - --------------------------------- */ - - // Registering void, valid but not useful at all. - rtl::type().record("int").build(), - - // Registering type 'void' again, ignored & emits- - // [WARNING] Multiple registrations of the same type detected. - rtl::type().record("int").build(), - - // Registering type 'void' again, but with different name. ignored & emits- - // [WARNING] Multiple registrations of the same type detected. - rtl::type().record("ccint").build(), - - // Registering pod, reflecting- constructor, copy-constructor & destructor. - rtl::type().record("char").build(), - - rtl::type().ns("std").record("string_view").build(), - - // Registers std::string class - rtl::type().member().methodConst("empty").build(&std::string::empty), - - /* Attempting to register the same type(`std::string`) again under a different name. - * RTL will ignore this duplicate registration and retain the first one. Emits a warning on the console: - * "[WARNING] Multiple registrations of the same type with different names detected." - */ rtl::type().member().methodConst("empty").build(&std::string::empty), - - rtl::type().ns("std").record("string").build(), - - /* Attempting to register std::string_view, but the provided member function pointer belongs to std::string. - * RTL will ignore this registration. Emits a warning on the console: - * "[WARNING] Member function pointer does not belong to the class being registered!" - */ rtl::type().member().methodConst("empty").build(&std::string::empty), - - //// Finally, register std::string_view with correct member-function-pointer - // rtl::type().ns("ccstd").record().methodConst("empty").build(&std::string_view::empty), - - // Finally, register std::string_view with correct member-function-pointer - rtl::type().member().methodConst("empty").build(&std::string_view::empty), - - - /* ----------------------------------------------------------------- - Registering global, C-like functions, with & without namespaces. - ----------------------------------------------------------------- */ - - // Function taking no arguments. '' must be specified if other overload exists else not needed. compiler error otherwise. - rtl::type().function(str_reverseString).build(reverseString), - - // Overloaded function, takes 'string' arguments. '' must be specified as template parameter. - rtl::type().function(str_reverseString).build(reverseString), - - // Overloaded function, takes 'const char*' arguments. - rtl::type().function(str_reverseString).build(reverseString), - - // Unique function, no overloads, no need to specify signature as template parameters. - rtl::type().function(str_getComplexNumAsString).build(getComplexNumAsString), + static auto cxx_mirror = rtl::CxxMirror( + []() { - /* Grouping functions under a namespace, which is optional. they can be registered without it as well. - but if registered under namspace, then to retrieve it from CxxMirror object, namespace name must be passed, - e.g. cxx::mirror().getFunction("namespace_name", "function_name") & cxx::mirror().getRecord("namespace_name", "record_name") - */ rtl::type().ns(str_complex).function(str_setReal).build(complex::setReal), - rtl::type().ns(str_complex).function(str_setImaginary).build(complex::setImaginary), - rtl::type().ns(str_complex).function(str_getMagnitude).build(complex::getMagnitude), + std::vector meta_fns; + registerPodStdTypes(meta_fns); - /* ----------------------------------------------------------------------------------------------------------- - Registering user defined types. class/struct- generally termed as 'Record' as per LLVM's naming convention - ----------------------------------------------------------------------------------------------------------- */ + registerTypeBook(meta_fns); + registerTypeDate(meta_fns); + registerTypeEvent(meta_fns); + registerTypePerson(meta_fns); + registerTypeAnimal(meta_fns); + registerTypeLibrary(meta_fns); + registerTypeComplex(meta_fns); + registerTypeCalender(meta_fns); - // Constructors registration, class/struct name and type must be passed 'record("NAME")'. - // Registers default constructor with implicit registration of destructor & copy-constructor. - rtl::type().ns(date::ns).record(date::struct_).build(), - - // Overloaded constructor, taking 'string' as argument, signature must be specified as template parameter. - rtl::type().member().constructor().build(), - - // Again, register an overloaded constructor with diffeent signature. - rtl::type().member().constructor().build(), - - // Registring, Unique method, no overloads. Taking param 'std::string', auto deduced via function-pointer. - rtl::type().member().method(date::str_updateDate).build(&nsdate::Date::updateDate), - - // Registring const-method, 'methodConst()' function must be used. compiler error otherwise. - rtl::type().member().methodConst(date::str_getAsString).build(&nsdate::Date::getAsString), - - // Registring static-method, 'methodStatic()' function must be used. compiler error otherwise. - rtl::type().member().methodStatic(calender::str_create).build(&nsdate::Calender::create), - - // Registring unique methods of class Calender, no overloads. - rtl::type().member().method(calender::str_getTheEvent).build(&nsdate::Calender::getTheEvent), - rtl::type().member().method(calender::str_getTheDate).build(&nsdate::Calender::getTheDate), - rtl::type().member().method(calender::str_getSavedEvent).build(&nsdate::Calender::getSavedEvent), - rtl::type().member().method(calender::str_getSavedDate).build(&nsdate::Calender::getSavedDate), - - // class Calender, registering after the methods. (order doesn't matter) - rtl::type().ns(date::ns).record(calender::struct_).build(), - - // Registering 'Event' for reflection; instance creation fails since its default constructor is private or deleted. - // At least one member must be registered for RTL to recognize the type. be it property, member-function or constructor. - rtl::type().ns(event::ns).record(event::struct_).build(), - rtl::type().member().method(event::str_reset).build(&nsdate::Event::reset), - - // Registering Library's constructor. Stack allocation (rtl::alloc::Stack) will fail since its copy constructor is deleted - // and its required by 'std::any' to store its object via copy-construction. But instance on heap (rtl::alloc::HEAP) can be - // constructed since, in that case, 'std::any' stores only the poiner which does not requires copy constructor to be called. - rtl::type().record(library::class_).build(), - - // Registring static-method, 'methodStatic()' function must be used. compiler error otherwise. - rtl::type().member().methodStatic(library::str_addBook).build(&Library::addBook), - rtl::type().member().methodStatic(library::str_getBookByTitle).build(&Library::getBookByTitle), - - // class 'Book', methods & constructors. - // Registering default constructor. - rtl::type().record(book::class_).build(), - - // Registering overloaded constructor, signature must be specified as template parameter. - rtl::type().member().constructor().build(), - - // Unique methods, no overloads. - rtl::type().member().method(book::str_setAuthor).build(&Book::setAuthor), - - // Unique method, taking 'std::string' & 'const std::string&' as argument, auto deduced via function-pointer. - rtl::type().member().method(book::str_addPreface).build(&Book::addPreface), - - // Furthur registrations of unique-menthods, signature auto-deduced via function pointer. - rtl::type().member().method(book::str_setDescription).build(&Book::setDescription), - rtl::type().member().method(book::str_getPublishedOn).build(&Book::getPublishedOn), - rtl::type().member().method(book::str_addCopyrightTag).build(&Book::addCopyrightTag), - - // Registering overloaded methods, signature must be specified as template params since other overloads exists, else compiler error. - rtl::type().member().method(book::str_updateBookInfo).build(&Book::updateBookInfo), - rtl::type().member().method(book::str_updateBookInfo).build(&Book::updateBookInfo), - rtl::type().member().method(book::str_updateBookInfo).build(&Book::updateBookInfo), - - // class 'Person', methods & constructors. - rtl::type().record(person::class_).build(), - rtl::type().member().constructor().build(), - rtl::type().member().methodStatic(person::str_createPtr).build(&Person::createPtr), - rtl::type().member().method(person::str_updateAddress).build(&Person::updateAddress), - rtl::type().member().method(person::str_updateAddress).build(&Person::updateAddress), - rtl::type().member().method(person::str_getFirstName).build(&Person::getFirstName), - - // Registring const-method, 'methodConst()' function must be used. compiler error otherwise. - rtl::type().member().methodConst(person::str_updateLastName).build(&Person::updateLastName), - - // Registring const-method overload, non-const overloaded method already registered above. - rtl::type().member().methodConst(person::str_updateAddress).build(&Person::updateAddress), - rtl::type().member().methodConst(person::str_updateAddress).build(&Person::updateAddress), - rtl::type().member().methodStatic(person::str_getDefaults).build(&Person::getDefaults), - rtl::type().member().methodStatic(person::str_createConst).build(&Person::createConst), - rtl::type().member().methodStatic(person::str_getProfile).build(&Person::getProfile), - rtl::type().member().methodStatic(person::str_getProfile).build(&Person::getProfile), - rtl::type().member().methodStatic(person::str_getProfile).build(&Person::getProfile), - - // class 'Animal', methods & constructors. - rtl::type().record(animal::class_).build(), - rtl::type().member().constructor().build(), //overloaded constructor. - rtl::type().member().method(animal::str_setFamilyName).build(&Animal::setFamilyName), //unique method, no overloads. - - // Unique const-method, no overloads. - rtl::type().member().methodConst(animal::str_getFamilyName).build(&Animal::getFamilyName), - - // Overloaded method, taking const-ref as argument. - rtl::type().member().method(animal::str_setAnimalName).build(&Animal::setAnimalName), - - // Static method, taking const-ref as argument. - rtl::type().member().methodStatic(animal::str_updateZooKeeper).build(&Animal::updateZooKeeper), - - #if defined(__GNUC__) && !defined(__clang__) - /* GCC fails to automatically identify the correct overloaded functor to pick. (non-const-lvalue-ref & rvalue as argument) - we need to explicitly cast the functor like, static_cast(&Animal::setAnimalName). - */ rtl::type().member() - .method(animal::str_setAnimalName) - .build(static_cast(&Animal::setAnimalName)), //overloaded method, taking non-const lvalue reference as argument. - - rtl::type().member() - .method(animal::str_setAnimalName) - .build(static_cast(&Animal::setAnimalName)), //overloaded method, taking rvalue reference as argument. - - rtl::type().member() - .methodStatic(animal::str_updateZooKeeper) - .build(static_cast(&Animal::updateZooKeeper)), //static method, taking non-const lvalue reference as argument. - - rtl::type().member() - .methodStatic(animal::str_updateZooKeeper) - .build(static_cast(&Animal::updateZooKeeper)), //static method, taking rvalue reference as argument. - #else - rtl::type().member() - .method(animal::str_setAnimalName) - .build(&Animal::setAnimalName), //overloaded method, taking non-const lvalue reference as argument. - - rtl::type().member() - .method(animal::str_setAnimalName) - .build(&Animal::setAnimalName), //overloaded method, taking rvalue reference as argument. - - rtl::type().member() - .methodStatic(animal::str_updateZooKeeper) - .build(&Animal::updateZooKeeper), //static method, taking non-const lvalue reference as argument. - - rtl::type().member() - .methodStatic(animal::str_updateZooKeeper) - .build(&Animal::updateZooKeeper), //static method, taking rvalue reference as argument. - #endif - }); + registerTypeStringMute(meta_fns); + registerTypeStringConst(meta_fns); + registerTypeStringFuncs(meta_fns); + registerTypeStringStatic(meta_fns); + return meta_fns; + }() + ); static const auto _= [&]() { @@ -250,47 +48,29 @@ namespace test_mirror return cxx_mirror; } -} - - - -namespace test_mirror -{ - //Optional setup for accessing registered types via unique-ids. - std::size_t reflected_id::book = rtl::detail::TypeId::get(); - std::size_t reflected_id::person = rtl::detail::TypeId::get(); - std::size_t reflected_id::animal = rtl::detail::TypeId::get(); - std::size_t reflected_id::library = rtl::detail::TypeId::get(); - std::size_t reflected_id::date = rtl::detail::TypeId::get(); - std::size_t reflected_id::event = rtl::detail::TypeId::get(); - std::size_t reflected_id::calender = rtl::detail::TypeId::get(); - - std::size_t reflected_id::int_t = rtl::detail::TypeId::get(); - std::size_t reflected_id::char_t = rtl::detail::TypeId::get(); - std::size_t reflected_id::std_string = rtl::detail::TypeId::get(); - std::size_t reflected_id::std_string_view = rtl::detail::TypeId::get(); - - //Optional setup - mapping unique-ids to string type-names (for Testing-Purposes only). - const std::size_t reflected_id::getRecordIdFor(const std::string& pRecordName) + const std::size_t cxx::reflected_id(const std::string& pRecordName) { - static std::unordered_map nameIdMap( + static std::unordered_map nameIdMap = []() { - { "char", char_t }, - { "int", int_t }, - { "string", std_string }, - { "string_view", std_string_view }, - - { book::class_, book }, - { date::struct_, date }, - { event::struct_, event }, - { animal::class_, animal }, - { person::class_, person }, - { library::class_, library }, - { calender::struct_, calender } - }); + std::unordered_map idMap; + + addTypeIdBook(idMap); + addTypeIdDate(idMap); + addTypeIdEvent(idMap); + addTypeIdPerson(idMap); + addTypeIdPodStd(idMap); + addTypeIdAnimal(idMap); + addTypeIdLibrary(idMap); + addTypeIdCalender(idMap); + addTypeIdStringMute(idMap); + addTypeIdStringConst(idMap); + addTypeIdStringStatic(idMap); + + return idMap; + }(); const auto& itr = nameIdMap.find(pRecordName); - return (itr == nameIdMap.end() ? rtl::index_none:itr->second); + return (itr == nameIdMap.end() ? rtl::index_none : itr->second); } } \ No newline at end of file diff --git a/CxxTestUtils/CMakeLists.txt b/CxxTestUtils/CMakeLists.txt index b43de122..c92ffa61 100644 --- a/CxxTestUtils/CMakeLists.txt +++ b/CxxTestUtils/CMakeLists.txt @@ -14,8 +14,9 @@ ADD_LIBRARY(${PROJECT_NAME} STATIC "") INCLUDE_DIRECTORIES(inc) INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/CxxTestProps/inc") -INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/ReflectionTemplateLib/common") -INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/ReflectionTemplateLib/access/inc") -INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/ReflectionTemplateLib/detail/inc") + +TARGET_LINK_LIBRARIES(${CXX_LIB_NAME} CxxTestProps) +TARGET_LINK_LIBRARIES(${CXX_LIB_NAME} ReflectionTemplateLib) + # Add the source directory INCLUDE(src/CMakeLists.txt) \ No newline at end of file diff --git a/CxxTestUtils/inc/GlobalTestUtils.h b/CxxTestUtils/inc/GlobalTestUtils.h index c1fdda10..9e4c43ad 100644 --- a/CxxTestUtils/inc/GlobalTestUtils.h +++ b/CxxTestUtils/inc/GlobalTestUtils.h @@ -10,6 +10,23 @@ Provides interface for Testing/Comparing the global functions & types (may or no */ namespace test_utils { + extern const char* SUFFIX_void; + extern const char* SUFFIX_const; + extern const char* SUFFIX_static; + extern const char* SUFFIX_const_char_ptr; + + extern const char* SUFFIX_std_string; + extern const char* SUFFIX_std_string_ptr; + extern const char* SUFFIX_std_string_cptr; + extern const char* SUFFIX_std_string_lvref; + extern const char* SUFFIX_std_string_rvref; + extern const char* SUFFIX_std_string_clvref; + + extern const char* SUFFIX_std_string_view; + extern const char* SUFFIX_std_string_view_lvref; + extern const char* SUFFIX_std_string_view_rvref; + extern const char* SUFFIX_std_string_view_clvref; + extern const char* REV_STR_VOID_RET; static constexpr double g_real = 3.92; @@ -21,11 +38,19 @@ namespace test_utils { static constexpr const char* STRB = "cxxReflection"; static constexpr const char* STRB_REVERSE = "noitcelfeRxxc"; - static constexpr const char* str_reverseString = "reverseString"; + static constexpr const char* str_reverseString = "reverseString"; + static constexpr const char* str_revStrConstRefArg = "revStrConstRefArg"; + static constexpr const char* str_revStrRValueRefArg = "revStrRValueRefArg"; + static constexpr const char* str_revStrNonConstRefArg = "revStrNonConstRefArg"; + static constexpr const char* str_revStrOverloadValRef = "revStrOverloadValRef"; + static constexpr const char* str_revStrOverloadValCRef = "revStrOverloadValCRef"; + static constexpr const char* str_revStrOverloadValRefAndCRef = "revStrOverloadValRefAndCRef"; + static constexpr const char* str_getComplexNumAsString = "getComplexNumAsString"; static constexpr const char* str_complex = "complex"; static constexpr const char* str_setReal = "setReal"; + static constexpr const char* str_setImaginary = "setImaginary"; static constexpr const char* str_getMagnitude = "getMagnitude"; } \ No newline at end of file diff --git a/CxxTestUtils/src/CMakeLists.txt b/CxxTestUtils/src/CMakeLists.txt index f24a709c..e68f9522 100644 --- a/CxxTestUtils/src/CMakeLists.txt +++ b/CxxTestUtils/src/CMakeLists.txt @@ -10,12 +10,6 @@ set(LOCAL_SOURCES "${CMAKE_CURRENT_LIST_DIR}/TestUtilsDate.cpp" "${CMAKE_CURRENT_LIST_DIR}/TestUtilsPerson.cpp" "${CMAKE_CURRENT_LIST_DIR}/TestUtilsAnimal.cpp" - "${CMAKE_SOURCE_DIR}/CxxTestProps/src/Book.cpp" - "${CMAKE_SOURCE_DIR}/CxxTestProps/src/Complex.cpp" - "${CMAKE_SOURCE_DIR}/CxxTestProps/src/Date.cpp" - "${CMAKE_SOURCE_DIR}/CxxTestProps/src/Person.cpp" - "${CMAKE_SOURCE_DIR}/CxxTestProps/src/Animal.cpp" - "${CMAKE_SOURCE_DIR}/CxxTestProps/src/Library.cpp" ) SET(LOCAL_HEADERS @@ -25,12 +19,6 @@ SET(LOCAL_HEADERS "${PROJECT_SOURCE_DIR}/inc/GlobalTestUtils.h" "${PROJECT_SOURCE_DIR}/inc/TestUtilsPerson.h" "${PROJECT_SOURCE_DIR}/inc/TestUtilsAnimal.h" - "${CMAKE_SOURCE_DIR}/CxxTestProps/inc/Book.h" - "${CMAKE_SOURCE_DIR}/CxxTestProps/inc/Complex.h" - "${CMAKE_SOURCE_DIR}/CxxTestProps/inc/Date.h" - "${CMAKE_SOURCE_DIR}/CxxTestProps/inc/Person.h" - "${CMAKE_SOURCE_DIR}/CxxTestProps/inc/Animal.h" - "${CMAKE_SOURCE_DIR}/CxxTestProps/inc/Library.h" ) # Add any additional source files if needed diff --git a/README.md b/README.md index 081a61c0..d0c79da8 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,37 @@ -# Reflection Template Library - Modern C++ Reflection Framework +# Reflection Template Library (RTL) — A Modern C++ Run-Time Reflection Framework -*Reflection Template Library (RTL)* is a lightweight C++ runtime reflection library that enables introspection and dynamic manipulation of ***Types*** — allowing you to access, modify, and invoke objects at runtime without compile-time type knowledge. - -RTL is implemented as a *static library* that organizes function pointers into `std::vector` tables, with each functor wrapped in a lambda. This design enables constant-time `O(1)` lookups while ensuring type-safe and efficient runtime access. +**RTL** brings rich, type-safe run-time reflection to modern C++ — combining compile-time safety with run-time flexibility. [![CMake](https://img.shields.io/badge/CMake-Enabled-brightgreen)](https://cmake.org) [![C++20](https://img.shields.io/badge/C++-20-blue)](https://isocpp.org) [![RTL Build](https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP/actions/workflows/build.yml/badge.svg?branch=release)](https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP/actions/workflows/build.yml?query=branch%3Arelease) [![License: MIT](https://img.shields.io/badge/License-MIT-green)](LICENSE) +### 🪞 What’s “Reflection”? +Reflection lets you interact with code by `name` instead of by `type`. Imagine you’ve written a simple function, +```c++ +std::string complexToStr(float real, float img); +``` +**RTL** lets you call it dynamically: +```c++ +rtl::function cToStr = cxx::mirror().getFunction("complexToStr") // cxx::mirror?? see quick preview! + ->argsT() + .returnT(); +if(cToStr) { // Function materialized? + std::string result = cToStr(61, 35); // Works! (int → float? No problem.) +} +``` +> *No includes. No compile-time linking. No argument type-casting. No guesswork. Just run-time lookup and type-safe invocation.* +### ⚡ Performance + +Overhead? Practically none. **RTL**’s reflective calls — when return and argument types are known — are just a native function-pointer hop, often faster than `std::function`. + +Yes — `rtl::function`’s dispatch is faster than `std::function`. -## What RTL Brings to Your Code +> *Microbenchmarks show reflective invocations through `rtl::function` have lower call overhead — a single, native pointer jump with no extra indirection. Once the functions start doing real work, both perform identically.* -* ***Runtime Reflection for C++*** – Introspect and manipulate objects dynamically, similar to Java or .NET, but with modern C++ idioms. +### 💡 In One Line + +*"RTL is a lightweight, static library that enables a robust, type-safe run-time reflection system for C++ — as flexible as in managed languages, yet as close as possible to native performance."* + +## What’s more? * ***Single Source of Truth*** – All metadata lives in one immutable `rtl::CxxMirror`, ensuring a consistent, thread-safe, duplication-free, and deterministic view of reflection data. @@ -19,8 +41,6 @@ RTL is implemented as a *static library* that organizes function pointers into ` * ***Exception-Free Surface*** – All predictable failures return error codes; no hidden throws. -* ***Deterministic Lifetimes*** – Automatic ownership tracking of `Heap` and `Stack` instances with zero hidden deep copies. - * ***Cross-Compiler Consistency*** – Pure standard C++20, with no compiler extensions or conditional branching on compiler differences. * ***Tooling-Friendly Architecture*** – Reflection data is encapsulated in a single immutable, lazily-initialized object that can be shared with tools and frameworks without compile-time type knowledge — ideal for serializers, debuggers, test frameworks, scripting engines, and editors. @@ -32,22 +52,40 @@ RTL is implemented as a *static library* that organizes function pointers into ` ## A Quick Preview: Reflection That Looks and Feels Like C++ ```c++ -#include "RTLibInterface.h" // Reflection access interface. +#include // Reflection access interface. ``` -Create an instance of `CxxMirror`, passing all type information directly to its constructor — and you're done! +Create an instance of `CxxMirror`, passing all type information directly to its constructor — and you’re done! ```c++ auto cxx_mirror = rtl::CxxMirror({ - /* ...register all types here... */ - rtl::type().record("Person").build(), + // Register free(C-Style) function - + rtl::type().function("complexToStr").build(complexToStr), + // Register class 'Person' ('record' is general term used for 'struct/class') - + rtl::type().record("Person").build(), // Registers default/copy ctor as well. + // Register user-defined ctor - rtl::type().member().constructor().build(), - rtl::type().member().method("setAge").build(Person::setAge), - rtl::type().member().method("getName").build(Person::getName) + // Register methods - + rtl::type().member().method("setAge").build(&Person::setAge), + rtl::type().member().method("getName").build(&Person::getName) }); ``` +The `cxx_mirror` object is your gateway to runtime reflection — it lets you query, introspect, and even instantiate types without any compile-time knowledge. It can live anywhere — in any translation unit, quietly resting in a corner of your codebase, remaining dormant until first access. All you need is to expose the `cxx_mirror` wherever reflection is required. -With just this much, you’ve registered your types and unlocked full runtime reflection. The `cxx_mirror` object is your gateway to query, introspect, and instantiate types at runtime — all without compile-time knowledge of those types, without strict static coupling. +And what better way to do that than a **Singleton**: +```c++ +struct cxx { static rtl::CxxMirror& mirror(); }; +``` +define and register everything in an isolated translation unit. +```c++ +rtl::CxxMirror& cxx::mirror() { + static auto cxx_mirror = rtl::CxxMirror({ + /* ...register all types here... */ + }); + return cxx_mirror; +} +``` +> Singleton ensures one central registry, initialized once, accessible everywhere. No static coupling, no multiple instances, just clean runtime reflection. -***Without reflection:*** +**Without reflection:** ```c++ Person p("John", 42); @@ -55,11 +93,11 @@ p.setAge(43); std::cout << p.getName(); ``` -***With reflection:*** +**With reflection:** ```c++ // Look up the class by name -std::optional classPerson = cxx_mirror.getRecord("Person"); +std::optional classPerson = cxx::mirror().getRecord("Person"); if (classPerson) // Check has_value() before use. { @@ -99,9 +137,9 @@ RTL lets you create reflected objects on the `Heap` or `Stack` with automatic li * Move semantics — `Heap` objects follow `std::unique_ptr` rules (move transfers ownership, copy/assign disabled). `Stack` objects move like regular values. -* Return values — All returns are propagated back wrapped in `rtl::RObject`, with temporaries (e.g. smart pointers) cleaned up automatically at scope exit. +* Return values — All returns are propagated back wrapped in `rtl::RObject`, cleaned up automatically at scope exit. -RTL doesn’t invent a new paradigm — it extends C++ itself. You create objects, call methods, and work with types as usual, but now safely at runtime. +RTL doesn’t invent a new paradigm — it extends C++ itself. You create objects, call methods, and work with types as usual, but now safely at run-time. ## Reflection Features @@ -122,15 +160,15 @@ RTL doesn’t invent a new paradigm — it extends C++ itself. You create object * Const/Non-const methods. * Any overloaded method, Const/Non-Const based as well. -* ✅ **Perfect Forwarding** – Binds LValue/RValue to correct overload. -* ✅ **Zero Overhead Forwarding** – No temporaries or copies during method forwarding. -* ✅ **Namespace Support** – Group and reflect under namespaces. -* ✅ **Reflected Returns** – Access return values whose types are unknown at compile time. Validate against the expected type and extract the content safely. -* ✅ **Smart Pointer Reflection** – Reflect `std::shared_ptr` and `std::unique_ptr`, transparently access the underlying type, and benefit from automatic lifetime management with full sharing and cloning semantics. -* 🟨 **Conservative Conversions** – Safely reinterpret reflected values without hidden costs. For example: treat an `int` as a `char`, or a `std::string` as a `std::string_view` / `const char*` — with no hidden copies and only safe, non-widening POD conversions. *(In Progress)* -* 🟨 **Materialize New Types** – Convert a reflected type `A` into type `B` if they are implicitly convertible. Define custom conversions at registration to make them available automatically. *(In Progress)* -* 🚧 **STL Wrapper Support** – Extended support for wrappers like `std::optional` and `std::reference_wrapper`. Return them, forward them as parameters, and access wrapped entities transparently. *(In Progress)* -* 🚧 **Relaxed Argument Matching** – Flexible parameter matching for reflective calls, enabling intuitive conversions and overload resolution. *(In Progress)* +* ✅ **Perfect Forwarding** 🚀 – Binds LValue/RValue to correct overload. +* ✅ **Zero Overhead Forwarding** ⚡ – No temporaries or copies during method forwarding. +* ✅ **Namespace Support** 🗂️ – Group and reflect under namespaces. +* ✅ **Reflected Returns** 🔍 – Access return values whose types are unknown at compile-time. Validate against the expected type and use them as if the type was known all along. +* ✅ **Smart Pointer Reflection** 🔗 – Reflect `std::shared_ptr` and `std::unique_ptr`, transparently access the underlying type, and benefit from automatic lifetime management with full sharing and cloning semantics. +* 🟨 **Conservative Conversions** 🛡️ – Safely reinterpret reflected values without hidden costs. For example: treat an `int` as a `char`, or a `std::string` as a `std::string_view` / `const char*` — with no hidden copies and only safe, non-widening POD conversions. *(In Progress)* +* 🟨 **Materialize New Types** 🔄 – Convert a reflected type `A` into type `B` if they are implicitly convertible. Define custom conversions at registration to make them available automatically. *(In Progress)* +* 🚧 **STL Wrapper Support** 📦 – Extended support for wrappers like `std::optional` and `std::reference_wrapper`. Return them, forward them as parameters, and handle them seamlessly. *(In Progress)* +* 🚧 **Relaxed Argument Matching** ⚙️ – Flexible parameter matching for reflective calls, enabling intuitive conversions and overload resolution. *(In Progress)* * ❌ **Property Reflection**: Planned. * ❌ **Enum Reflection**: Planned. * ❌ **Composite Type Reflection**: Planned. diff --git a/RTLBenchmarkApp/CMakeLists.txt b/RTLBenchmarkApp/CMakeLists.txt index ae302c8c..7e94e053 100644 --- a/RTLBenchmarkApp/CMakeLists.txt +++ b/RTLBenchmarkApp/CMakeLists.txt @@ -25,16 +25,6 @@ if(NOT benchmark_POPULATED) add_subdirectory(${benchmark_SOURCE_DIR} ${benchmark_BINARY_DIR} EXCLUDE_FROM_ALL) endif() -# =============================== -# Common Include Paths -# =============================== -set(RTL_INCLUDE_DIRS - inc - "${CMAKE_SOURCE_DIR}/ReflectionTemplateLib/common" - "${CMAKE_SOURCE_DIR}/ReflectionTemplateLib/detail/inc" - "${CMAKE_SOURCE_DIR}/ReflectionTemplateLib/access/inc" - "${CMAKE_SOURCE_DIR}/ReflectionTemplateLib/builder/inc" -) # =============================== # Test Executable @@ -51,8 +41,10 @@ add_executable(${CXX_EXE_NAME} src/StandardCall.h src/StandardCall.cpp src/StdFunction.cpp - src/ReflectedCall.h - src/ReflectedCall.cpp + src/ReflectedCallKnownReturn.h + src/ReflectedCallKnownReturn.cpp + src/ReflectedCallUnknownReturn.h + src/ReflectedCallUnknownReturn.cpp ) diff --git a/RTLBenchmarkApp/src/BenchMark.cpp b/RTLBenchmarkApp/src/BenchMark.cpp index 72b66cc6..8605dcfb 100644 --- a/RTLBenchmarkApp/src/BenchMark.cpp +++ b/RTLBenchmarkApp/src/BenchMark.cpp @@ -1,11 +1,10 @@ #include -#include -#include +#include #include "BenchMark.h" -#include "RTLibInterface.h" + namespace bm @@ -20,34 +19,38 @@ namespace bm namespace bm { - void sendMessage(argStr_t pMsg) + void sendMessage(argStr_t pMsg) noexcept { if(g_work_load){ g_work_done = perform_work(pMsg); } } - void Node::sendMessage(argStr_t pMsg) + void Node::sendMessage(argStr_t pMsg) noexcept { if(g_work_load){ g_work_done = perform_work(pMsg); } } - retStr_t getMessage(argStr_t pMsg) + retStr_t getMessage(argStr_t pMsg) noexcept { + retStr_t retStr = g_work_done->c_str(); if(g_work_load){ g_work_done = perform_work(pMsg); + retStr = g_work_done->c_str(); } - return retStr_t(g_work_done->c_str()); + return retStr; } - retStr_t Node::getMessage(argStr_t pMsg) + retStr_t Node::getMessage(argStr_t pMsg) noexcept { + retStr_t retStr = g_work_done->c_str(); if(g_work_load){ g_work_done = perform_work(pMsg); + retStr = g_work_done->c_str(); } - return retStr_t(g_work_done->c_str()); + return retStr; } } diff --git a/RTLBenchmarkApp/src/BenchMark.h b/RTLBenchmarkApp/src/BenchMark.h index ac27f784..a6bbc513 100644 --- a/RTLBenchmarkApp/src/BenchMark.h +++ b/RTLBenchmarkApp/src/BenchMark.h @@ -10,8 +10,8 @@ namespace bm struct Node { - void sendMessage(argStr_t); - retStr_t getMessage(argStr_t); + void sendMessage(argStr_t) noexcept; + retStr_t getMessage(argStr_t) noexcept; }; } diff --git a/RTLBenchmarkApp/src/ReflectedCall.cpp b/RTLBenchmarkApp/src/ReflectedCall.cpp deleted file mode 100644 index 325c72ea..00000000 --- a/RTLBenchmarkApp/src/ReflectedCall.cpp +++ /dev/null @@ -1,119 +0,0 @@ - -#include - -#include "ReflectedCall.h" -#include "RTLibInterface.h" -#include "BenchMark.h" - -namespace cxx -{ - extern const rtl::CxxMirror& mirror(); -} - -namespace -{ - static rtl::Function GetMessage = cxx::mirror().getFunction("getMessage").value(); - static rtl::Function SendMessage = cxx::mirror().getFunction("sendMessage").value(); - - static rtl::Method NodeGetMessage = cxx::mirror().getRecord("Node")->getMethod("getMessage").value(); - static rtl::Method NodeSendMessage = cxx::mirror().getRecord("Node")->getMethod("sendMessage").value(); - - static rtl::RObject nodeObj = []() - { - auto Node = cxx::mirror().getRecord("Node").value(); - auto [err, robj] = Node.create(); - if (nodeObj.isEmpty()) { - std::cout << "[0] nodeObj empty! \n"; - } - return std::move(robj); - }(); -} - - - namespace - { - static auto _test0 = []() - { - auto err = SendMessage(bm::g_longStr).err; - - if (err != rtl::error::None) { - std::cout << "[1] error: "<< rtl::to_string(err)<<"\n"; - } - return 0; - }; - - static auto _test1 = []() - { - auto err = NodeSendMessage.bind(nodeObj).call(bm::g_longStr).err; - - if (err != rtl::error::None) { - std::cout << "[2] error: " << rtl::to_string(err) << "\n"; - } - return 0; - }; - - static auto _test2 = []() - { - auto err = GetMessage(bm::g_longStr).err; - - if (err != rtl::error::None) { - std::cout << "[3] error: " << rtl::to_string(err) << "\n"; - } - return 0; - }; - - static auto _test3 = []() - { - auto err = NodeGetMessage(nodeObj)(bm::g_longStr).err; - - if (err != rtl::error::None) { - std::cout << "[4] error: " << rtl::to_string(err) << "\n"; - } - return 0; - }; -} - - - -void ReflectedCall::set(benchmark::State& state) -{ - static auto _=_test0(); - for (auto _: state) { - - auto error = SendMessage(bm::g_longStr).err; - benchmark::DoNotOptimize(error); - } -} - - -void ReflectedCall::get(benchmark::State& state) -{ - static auto _=_test2(); - for (auto _: state) - { - auto error = GetMessage(bm::g_longStr).err; - benchmark::DoNotOptimize(error); - } -} - - -void ReflectedMethodCall::set(benchmark::State& state) -{ - static auto _=_test1(); - for (auto _: state) - { - auto error = NodeSendMessage(nodeObj)(bm::g_longStr).err; - benchmark::DoNotOptimize(error); - } -} - - -void ReflectedMethodCall::get(benchmark::State& state) -{ - static auto _=_test3(); - for (auto _: state) - { - auto error = NodeGetMessage(nodeObj)(bm::g_longStr).err; - benchmark::DoNotOptimize(error); - } -} \ No newline at end of file diff --git a/RTLBenchmarkApp/src/ReflectedCall.h b/RTLBenchmarkApp/src/ReflectedCall.h deleted file mode 100644 index 59416ca2..00000000 --- a/RTLBenchmarkApp/src/ReflectedCall.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include - -struct ReflectedCall -{ - static void set(benchmark::State& state); - - static void get(benchmark::State& state); -}; - - -struct ReflectedMethodCall -{ - static void set(benchmark::State& state); - - static void get(benchmark::State& state); -}; \ No newline at end of file diff --git a/RTLBenchmarkApp/src/ReflectedCallKnownReturn.cpp b/RTLBenchmarkApp/src/ReflectedCallKnownReturn.cpp new file mode 100644 index 00000000..b305cc7f --- /dev/null +++ b/RTLBenchmarkApp/src/ReflectedCallKnownReturn.cpp @@ -0,0 +1,187 @@ + +#include +#include +#include + +#include "BenchMark.h" +#include "Function.h" +#include "ReflectedCallKnownReturn.h" + + +namespace bm +{ + extern std::optional g_work_done; +} + +namespace cxx +{ + extern const rtl::CxxMirror& mirror(); +} + +namespace +{ + static const rtl::function getMessage = []() + { + std::optional function = cxx::mirror().getFunction("getMessage"); + if(!function) + { + std::cerr << "[00] error: erase_function 'getMessage' not found."; + std::abort(); + } + return function->argsT().returnT(); + }(); + + static const rtl::function sendMessage = []() + { + std::optional function = cxx::mirror().getFunction("sendMessage"); + if(!function) + { + std::cerr << "[01] error: erase_function 'sendMessage' not found."; + std::abort(); + } + return function->argsT().returnT(); + }(); + + static const rtl::method getMessageNode = []() + { + std::optional Node = cxx::mirror().getRecord("Node"); + if (!Node) { + std::cerr << "[x] error: record 'Node' not found"; + std::abort(); + } + + std::optional method = Node->getMethod("getMessage"); + if (!method) { + std::cerr << "[02] error: method 'Node::getMessage' not found."; + std::abort(); + } + return method->targetT().argsT().returnT(); + }(); + + static const rtl::method sendMessageNode = []() + { + std::optional Node = cxx::mirror().getRecord("Node"); + if (!Node) { + std::cerr << "[x] error: record 'Node' not found."; + std::abort(); + } + + std::optional method = Node->getMethod("sendMessage"); + if (!method) { + std::cerr << "[3] error: method 'Node::sendMessage' not found."; + std::abort(); + } + return method->targetT().argsT().returnT(); + }(); +} + + +namespace +{ + static auto _new_line = []() { + std::cout << std::endl; + return 0; + }; + + template + static bool test(const T& to, int callerId) + { + if (!to) { + std::cerr << "[" << callerId << "] error: functor not valid, return-type or signature mismatch."; + std::abort(); + } + return true; + } +} + + +namespace bm_call +{ + void via_function_ptr__Function::get_string(benchmark::State& state) + { + static auto _ = _new_line(); + static auto is_ok = test(getMessage, 0); + for (auto _ : state) + { + benchmark::DoNotOptimize((getMessage.f_ptr())(bm::g_longStr)); + } + } + + void via_function_ptr____Method::get_string(benchmark::State& state) + { + static bm::Node nodeObj; + static auto is_ok = test(getMessageNode, 1); + for (auto _ : state) + { + benchmark::DoNotOptimize((nodeObj.*getMessageNode.f_ptr())(bm::g_longStr)); + } + } + + void via_function_ptr__Function::set_string(benchmark::State& state) + { + static auto _ = _new_line(); + static auto is_ok = test(sendMessage, 2); + for (auto _ : state) + { + (sendMessage.f_ptr())(bm::g_longStr); + benchmark::DoNotOptimize(bm::g_work_done->c_str()); + } + } + + void via_function_ptr____Method::set_string(benchmark::State& state) + { + static bm::Node nodeObj; + static auto is_ok = test(getMessageNode, 2); + for (auto _ : state) + { + (nodeObj.*sendMessageNode.f_ptr())(bm::g_longStr); + benchmark::DoNotOptimize(bm::g_work_done->c_str()); + } + } +} + + +namespace bm_rtl +{ + void function_calls__Function::get_string(benchmark::State& state) + { + static auto _ = _new_line(); + static auto is_ok = test(getMessage, 3); + for (auto _ : state) + { + benchmark::DoNotOptimize(getMessage(bm::g_longStr)); + } + } + + void function_calls__Function::set_string(benchmark::State& state) + { + static auto _ = _new_line(); + static auto is_ok = test(sendMessage, 0); + for (auto _ : state) + { + sendMessage(bm::g_longStr); + benchmark::DoNotOptimize(bm::g_work_done->c_str()); + } + } + + void method_calls______Method::get_string(benchmark::State& state) + { + static bm::Node nodeObj; + static auto is_ok = test(getMessageNode, 4); + for (auto _ : state) + { + benchmark::DoNotOptimize(getMessageNode(nodeObj)(bm::g_longStr)); + } + } + + void method_calls______Method::set_string(benchmark::State& state) + { + static bm::Node nodeObj; + static auto is_ok = test(sendMessageNode, 5); + for (auto _ : state) + { + sendMessageNode(nodeObj)(bm::g_longStr); + benchmark::DoNotOptimize(bm::g_work_done->c_str()); + } + } +} \ No newline at end of file diff --git a/RTLBenchmarkApp/src/ReflectedCallKnownReturn.h b/RTLBenchmarkApp/src/ReflectedCallKnownReturn.h new file mode 100644 index 00000000..c8dbea8f --- /dev/null +++ b/RTLBenchmarkApp/src/ReflectedCallKnownReturn.h @@ -0,0 +1,37 @@ +#pragma once + +#include + +namespace bm_call +{ + struct via_function_ptr__Function + { + static void set_string(benchmark::State& state); + + static void get_string(benchmark::State& state); + }; + + struct via_function_ptr____Method + { + static void set_string(benchmark::State& state); + + static void get_string(benchmark::State& state); + }; +} + +namespace bm_rtl +{ + struct function_calls__Function + { + static void set_string(benchmark::State& state); + + static void get_string(benchmark::State& state); + }; + + struct method_calls______Method + { + static void set_string(benchmark::State& state); + + static void get_string(benchmark::State& state); + }; +} \ No newline at end of file diff --git a/RTLBenchmarkApp/src/ReflectedCallUnknownReturn.cpp b/RTLBenchmarkApp/src/ReflectedCallUnknownReturn.cpp new file mode 100644 index 00000000..2cdeaefa --- /dev/null +++ b/RTLBenchmarkApp/src/ReflectedCallUnknownReturn.cpp @@ -0,0 +1,339 @@ + +#include +#include + +#include "BenchMark.h" +#include "ReflectedCallUnknownReturn.h" + +namespace bm +{ + extern std::optional g_work_done; +} + +namespace cxx +{ + extern const rtl::CxxMirror& mirror(); +} + +namespace +{ + static rtl::Record class_Node = []() + { + std::optional Node = cxx::mirror().getRecord("Node"); + if (!Node) { + std::cerr << "[x] error: record 'Node' not found.\n"; + std::abort(); + } + return Node.value(); + }(); + + static rtl::RObject nodeObj = []() + { + auto [err, robj] = class_Node.create(); + if (robj.isEmpty()) { + std::cerr << "[x] error: " << rtl::to_string(err) << "\n"; + } + return std::move(robj); + }(); +} + +namespace +{ + static rtl::function ErasedReturnFn_GetMessage = []() + { + std::optional optFunction = cxx::mirror().getFunction("getMessage"); + if (!optFunction) { + std::cerr << "[0] error: function 'getMessage' not found.\n"; + std::abort(); + } + auto function = optFunction->argsT().returnT<>(); + if (!function) + { + std::cerr << "[0] error: invalid function caller.\n"; + std::abort(); + } + return function; + }(); + + static rtl::function ErasedReturnFn_SendMessage = []() + { + std::optional optFunction = cxx::mirror().getFunction("sendMessage"); + if (!optFunction) { + std::cerr << "[1] error: function 'sendMessage' not found.\n"; + std::abort(); + } + auto function = optFunction->argsT().returnT<>(); + if (!function) + { + std::cerr << "[1] error: invalid function caller.\n"; + std::abort(); + } + return function; + }(); +} + +namespace +{ + //---------------------------------------------------------------------------- + static rtl::method ErasedReturnAwareTarget_SendMessage = []() + { + std::optional optMethod = class_Node.getMethod("sendMessage"); + if (!optMethod) { + std::cerr << "[2] error: method 'Node::sendMessage' not found.\n"; + std::abort(); + } + auto method = optMethod->targetT().argsT().returnT<>(); + if (!method) { + std::cerr << "[2] error: invalid method caller.\n"; + std::abort(); + } + return method; + }(); + + static rtl::method ErasedTargetAwareReturn_SendMessage = []() + { + std::optional optMethod = class_Node.getMethod("sendMessage"); + if (!optMethod) { + std::cerr << "[3] error: method 'Node::sendMessage' not found.\n"; + std::abort(); + } + auto method = optMethod->targetT<>().argsT().returnT(); + if (!method) { + std::cerr << "[3] error: invalid method caller.\n"; + std::abort(); + } + return method; + }(); + + static rtl::method ErasedReturnAndTarget_SendMessage = []() + { + std::optional optMethod = class_Node.getMethod("sendMessage"); + if (!optMethod) { + std::cerr << "[4] error: method 'Node::sendMessage' not found.\n"; + std::abort(); + } + auto method = optMethod->targetT<>().argsT().returnT<>(); + if (!method) { + std::cerr << "[4] error: invalid method caller.\n"; + std::abort(); + } + return method; + }(); + + //---------------------------------------------------------------------------- + static rtl::method ErasedReturnAwareTarget_GetMessage = []() + { + std::optional optMethod = class_Node.getMethod("getMessage"); + if (!optMethod) { + std::cerr << "[5] error: method 'Node::getMessage' not found.\n"; + std::abort(); + } + auto method = optMethod->targetT().argsT().returnT<>(); + if (!method) { + std::cerr << "[5] error: invalid method caller.\n"; + std::abort(); + } + return method; + }(); + + static rtl::method ErasedTargetAwareReturn_GetMessage = []() + { + std::optional optMethod = class_Node.getMethod("getMessage"); + if (!optMethod) { + std::cerr << "[6] error: method 'Node::getMessage' not found.\n"; + std::abort(); + } + auto method = optMethod->targetT<>().argsT().returnT(); + if (!method) { + std::cerr << "[6] error: invalid method caller.\n"; + std::abort(); + } + return method; + }(); + + static rtl::method ErasedReturnAndTarget_GetMessage = []() + { + std::optional optMethod = class_Node.getMethod("getMessage"); + if (!optMethod) { + std::cerr << "[7] error: method 'Node::getMessage' not found.\n"; + std::abort(); + } + auto method = optMethod->targetT<>().argsT().returnT<>(); + if (!method) { + std::cerr << "[7] error: invalid method caller.\n"; + std::abort(); + } + return method; + }(); +} + +namespace +{ + static auto _test0 = []() + { + auto err = ErasedReturnFn_SendMessage(bm::g_longStr).err; + if (err != rtl::error::None) { + std::cerr << "[00] error: " << rtl::to_string(err) << "\n"; + } + return 0; + }; + + static auto _test1 = []() + { + auto err = ErasedReturnFn_GetMessage(bm::g_longStr).err; + if (err != rtl::error::None) { + std::cerr << "[01] error: " << rtl::to_string(err) << "\n"; + } + return 0; + }; +} + +namespace +{ + static auto _test2 = []() + { + auto err = ErasedReturnAwareTarget_SendMessage(bm::Node())(bm::g_longStr).err; + if (err != rtl::error::None) { + std::cerr << "[02] error: " << rtl::to_string(err) << "\n"; + } + return 0; + }; + + static auto _test3 = []() + { + auto err = ErasedReturnAwareTarget_GetMessage(bm::Node())(bm::g_longStr).err; + if (err != rtl::error::None) { + std::cerr << "[03] error: " << rtl::to_string(err) << "\n"; + } + return 0; + }; + + static auto _test4 = []() + { + auto err = ErasedReturnAndTarget_SendMessage(nodeObj)(bm::g_longStr).err; + if (err != rtl::error::None) { + std::cerr << "[04] error: " << rtl::to_string(err) << "\n"; + } + return 0; + }; + + static auto _test5 = []() + { + auto err = ErasedReturnAndTarget_GetMessage(nodeObj)(bm::g_longStr).err; + if (err != rtl::error::None) { + std::cerr << "[05] error: " << rtl::to_string(err) << "\n"; + } + return 0; + }; + + static auto _test6 = []() + { + auto [err, returnOpt] = ErasedTargetAwareReturn_SendMessage(nodeObj)(bm::g_longStr); + if (err != rtl::error::None) { + std::cerr << "[06] error: " << rtl::to_string(err) << "\n"; + } + return 0; + }; + + static auto _test7 = []() + { + auto [err, returnOpt] = ErasedTargetAwareReturn_SendMessage(nodeObj)(bm::g_longStr); + if (err != rtl::error::None) { + std::cerr << "[07] error: " << rtl::to_string(err) << "\n"; + } + return 0; + }; + + static auto _new_line = []() { + std::cerr << std::endl; + return 0; + }; +} + + +namespace bm_rtl +{ + void function__ErasedReturnType::set_string(benchmark::State& state) + { + static auto __ = _new_line(); + static auto _ = _test0(); + for (auto _ : state) + { + benchmark::DoNotOptimize(ErasedReturnFn_SendMessage(bm::g_longStr).err); + } + } + + void function__ErasedReturnType::get_string(benchmark::State& state) + { + static auto __ = _new_line(); + static auto _ = _test1(); + for (auto _ : state) + { + benchmark::DoNotOptimize(ErasedReturnFn_GetMessage(bm::g_longStr).err); + } + } +} + + +namespace bm_rtl +{ + void method____ErasedReturnType::set_string(benchmark::State& state) + { + static auto _ = _test2(); + static bm::Node node; + for (auto _ : state) + { + benchmark::DoNotOptimize(ErasedReturnAwareTarget_SendMessage(node)(bm::g_longStr)); + } + } + + void method____ErasedReturnType::get_string(benchmark::State& state) + { + static auto _ = _test3(); + static bm::Node node; + for (auto _ : state) + { + benchmark::DoNotOptimize(ErasedReturnAwareTarget_GetMessage(node)(bm::g_longStr)); + } + } + + void method____ErasedTargetType::set_string(benchmark::State& state) + { + static auto _ = _test2(); + static bm::Node node; + for (auto _ : state) + { + benchmark::DoNotOptimize(ErasedTargetAwareReturn_SendMessage(nodeObj)(bm::g_longStr)); + } + } + + void method____ErasedTargetType::get_string(benchmark::State& state) + { + static auto _ = _test3(); + static bm::Node node; + for (auto _ : state) + { + benchmark::DoNotOptimize(ErasedTargetAwareReturn_GetMessage(nodeObj)(bm::g_longStr)); + } + } + + void method____ErasedTargetAndReturnType::set_string(benchmark::State& state) + { + static auto _ = _test2(); + static bm::Node node; + for (auto _ : state) + { + benchmark::DoNotOptimize(ErasedReturnAndTarget_SendMessage(nodeObj)(bm::g_longStr)); + } + } + + void method____ErasedTargetAndReturnType::get_string(benchmark::State& state) + { + static auto _ = _test3(); + static bm::Node node; + for (auto _ : state) + { + benchmark::DoNotOptimize(ErasedReturnAndTarget_GetMessage(nodeObj)(bm::g_longStr)); + } + } +} \ No newline at end of file diff --git a/RTLBenchmarkApp/src/ReflectedCallUnknownReturn.h b/RTLBenchmarkApp/src/ReflectedCallUnknownReturn.h new file mode 100644 index 00000000..08dcaa3a --- /dev/null +++ b/RTLBenchmarkApp/src/ReflectedCallUnknownReturn.h @@ -0,0 +1,34 @@ +#pragma once + +#include + +namespace bm_rtl +{ + struct function__ErasedReturnType + { + static void set_string(benchmark::State& state); + + static void get_string(benchmark::State& state); + }; + + struct method____ErasedReturnType + { + static void set_string(benchmark::State& state); + + static void get_string(benchmark::State& state); + }; + + struct method____ErasedTargetType + { + static void set_string(benchmark::State& state); + + static void get_string(benchmark::State& state); + }; + + struct method____ErasedTargetAndReturnType + { + static void set_string(benchmark::State& state); + + static void get_string(benchmark::State& state); + }; +} \ No newline at end of file diff --git a/RTLBenchmarkApp/src/StandardCall.cpp b/RTLBenchmarkApp/src/StandardCall.cpp index 39dda878..5fc48105 100644 --- a/RTLBenchmarkApp/src/StandardCall.cpp +++ b/RTLBenchmarkApp/src/StandardCall.cpp @@ -1,4 +1,5 @@ +#include #include #include #include @@ -9,8 +10,8 @@ namespace { static auto _put_line = []() { - std::cout << "-------------------------------------" - "-------------------------------------" << std::endl; + std::cout << "-----------------------------------------------" + "---------------------------------------------------" << std::endl; return 0; }; @@ -31,71 +32,72 @@ namespace bm extern std::function SendMessage; - extern std::function NodeSendMessage; + extern std::function NodeSendMessage; extern std::function GetMessage; - extern std::function NodeGetMessage; + extern std::function NodeGetMessage; } - -void NativeCall::set(benchmark::State& state) +namespace bm_call { - for (auto _: state) + void direct__Function::set_string(benchmark::State& state) { - bm::sendMessage(bm::g_longStr); - benchmark::DoNotOptimize(bm::g_work_done->c_str()); + for (auto _ : state) + { + bm::sendMessage(bm::g_longStr); + benchmark::DoNotOptimize(bm::g_work_done->c_str()); + } } -} - -void NativeCall::get(benchmark::State& state) -{ - static auto _=_put_line(); - for (auto _: state) + void direct__Function::get_string(benchmark::State& state) { - benchmark::DoNotOptimize(bm::getMessage(bm::g_longStr)); + static auto _ = _put_line(); + for (auto _ : state) + { + benchmark::DoNotOptimize(bm::getMessage(bm::g_longStr)); + } } } -void StdFuncCall::set(benchmark::State& state) +namespace bm_std { - static auto _=_new_line(); - for (auto _: state) + void function_calls__Function::set_string(benchmark::State& state) { - bm::SendMessage(bm::g_longStr); - benchmark::DoNotOptimize(bm::g_work_done->c_str()); + static auto _ = _new_line(); + for (auto _ : state) + { + bm::SendMessage(bm::g_longStr); + benchmark::DoNotOptimize(bm::g_work_done->c_str()); + } } -} - -void StdFuncMethodCall::set(benchmark::State& state) -{ - static auto _=_new_line(); - for (auto _: state) + void function_calls____Method::set_string(benchmark::State& state) { - bm::NodeSendMessage(bm::g_longStr); - benchmark::DoNotOptimize(bm::g_work_done->c_str()); + static bm::Node nodeObj; + for (auto _ : state) + { + bm::NodeSendMessage(nodeObj, bm::g_longStr); + benchmark::DoNotOptimize(bm::g_work_done->c_str()); + } } -} - -void StdFuncCall::get(benchmark::State& state) -{ - static auto _=_new_line(); - for (auto _: state) + void function_calls__Function::get_string(benchmark::State& state) { - benchmark::DoNotOptimize(bm::GetMessage(bm::g_longStr)); + static auto _ = _new_line(); + for (auto _ : state) + { + benchmark::DoNotOptimize(bm::GetMessage(bm::g_longStr)); + } } -} - -void StdFuncMethodCall::get(benchmark::State& state) -{ - static auto _=_new_line(); - for (auto _: state) + void function_calls____Method::get_string(benchmark::State& state) { - benchmark::DoNotOptimize(bm::NodeGetMessage(bm::g_longStr)); + static bm::Node nodeObj; + for (auto _ : state) + { + benchmark::DoNotOptimize(bm::NodeGetMessage(nodeObj, bm::g_longStr)); + } } } \ No newline at end of file diff --git a/RTLBenchmarkApp/src/StandardCall.h b/RTLBenchmarkApp/src/StandardCall.h index da2e4a45..b74bad74 100644 --- a/RTLBenchmarkApp/src/StandardCall.h +++ b/RTLBenchmarkApp/src/StandardCall.h @@ -2,25 +2,30 @@ #include -struct NativeCall +namespace bm_call { - static void set(benchmark::State& state); - - static void get(benchmark::State& state); -}; + struct direct__Function + { + static void set_string(benchmark::State& state); + static void get_string(benchmark::State& state); + }; +} -struct StdFuncCall +namespace bm_std { - static void set(benchmark::State& state); + struct function_calls__Function + { + static void set_string(benchmark::State& state); - static void get(benchmark::State& state); -}; + static void get_string(benchmark::State& state); + }; -struct StdFuncMethodCall -{ - static void set(benchmark::State& state); + struct function_calls____Method + { + static void set_string(benchmark::State& state); - static void get(benchmark::State& state); -}; \ No newline at end of file + static void get_string(benchmark::State& state); + }; +} \ No newline at end of file diff --git a/RTLBenchmarkApp/src/StdFunction.cpp b/RTLBenchmarkApp/src/StdFunction.cpp index b7c170e3..b258b02d 100644 --- a/RTLBenchmarkApp/src/StdFunction.cpp +++ b/RTLBenchmarkApp/src/StdFunction.cpp @@ -1,4 +1,5 @@ +#include #include #include "BenchMark.h" @@ -19,8 +20,6 @@ namespace bm namespace bm { - static Node node; - extern void sendMessage(argStr_t); extern retStr_t getMessage(argStr_t); @@ -30,20 +29,20 @@ namespace bm bm::sendMessage(pMsg); }; - std::function NodeSendMessage = [](bm::argStr_t& pMsg) + std::function NodeSendMessage = [](bm::Node pNode, bm::argStr_t& pMsg) { - node.sendMessage(pMsg); + pNode.sendMessage(pMsg); }; std::function GetMessage = [](bm::argStr_t& pMsg) { - auto retMsg = bm::getMessage(pMsg); - return retMsg; + auto retMsg = bm::getMessage(pMsg); + return retMsg; }; - std::function NodeGetMessage = [](bm::argStr_t& pMsg) + std::function NodeGetMessage = [](bm::Node pNode, bm::argStr_t& pMsg) { - auto retMsg = node.getMessage(pMsg); + auto retMsg = pNode.getMessage(pMsg); return retMsg; }; } diff --git a/RTLBenchmarkApp/src/main.cpp b/RTLBenchmarkApp/src/main.cpp index bcefd8d1..20c9a0f7 100644 --- a/RTLBenchmarkApp/src/main.cpp +++ b/RTLBenchmarkApp/src/main.cpp @@ -1,26 +1,42 @@ #include -#include #include #include "StandardCall.h" -#include "ReflectedCall.h" +#include "ReflectedCallKnownReturn.h" +#include "ReflectedCallUnknownReturn.h" -BENCHMARK(NativeCall::set); +BENCHMARK(bm_call::direct__Function::set_string); -BENCHMARK(StdFuncCall::set); -BENCHMARK(ReflectedCall::set); +BENCHMARK(bm_call::via_function_ptr__Function::set_string); +BENCHMARK(bm_call::via_function_ptr____Method::set_string); -BENCHMARK(StdFuncMethodCall::set); -BENCHMARK(ReflectedMethodCall::set); +BENCHMARK(bm_std::function_calls__Function::set_string); +BENCHMARK(bm_std::function_calls____Method::set_string); -BENCHMARK(NativeCall::get); +BENCHMARK(bm_rtl::function_calls__Function::set_string); +BENCHMARK(bm_rtl::method_calls______Method::set_string); -BENCHMARK(StdFuncCall::get); -BENCHMARK(ReflectedCall::get); +BENCHMARK(bm_rtl::function__ErasedReturnType::set_string); +BENCHMARK(bm_rtl::method____ErasedReturnType::set_string); +BENCHMARK(bm_rtl::method____ErasedTargetType::set_string); +BENCHMARK(bm_rtl::method____ErasedTargetAndReturnType::set_string); -BENCHMARK(StdFuncMethodCall::get); -BENCHMARK(ReflectedMethodCall::get); +BENCHMARK(bm_call::direct__Function::get_string); + +BENCHMARK(bm_call::via_function_ptr__Function::get_string); +BENCHMARK(bm_call::via_function_ptr____Method::get_string); + +BENCHMARK(bm_std::function_calls__Function::get_string); +BENCHMARK(bm_std::function_calls____Method::get_string); + +BENCHMARK(bm_rtl::function_calls__Function::get_string); +BENCHMARK(bm_rtl::method_calls______Method::get_string); + +BENCHMARK(bm_rtl::function__ErasedReturnType::get_string); +BENCHMARK(bm_rtl::method____ErasedReturnType::get_string); +BENCHMARK(bm_rtl::method____ErasedTargetType::get_string); +BENCHMARK(bm_rtl::method____ErasedTargetAndReturnType::get_string); namespace bm { diff --git a/RTLTestRunApp/CMakeLists.txt b/RTLTestRunApp/CMakeLists.txt index 3b2177eb..3b88d6c2 100644 --- a/RTLTestRunApp/CMakeLists.txt +++ b/RTLTestRunApp/CMakeLists.txt @@ -31,10 +31,6 @@ set(RTL_INCLUDE_DIRS inc "${CMAKE_SOURCE_DIR}/CxxTestUtils/inc" "${CMAKE_SOURCE_DIR}/CxxTestRegistration/inc" - "${CMAKE_SOURCE_DIR}/ReflectionTemplateLib/common" - "${CMAKE_SOURCE_DIR}/ReflectionTemplateLib/detail/inc" - "${CMAKE_SOURCE_DIR}/ReflectionTemplateLib/access/inc" - "${CMAKE_SOURCE_DIR}/ReflectionTemplateLib/builder/inc" ) # =============================== @@ -42,7 +38,6 @@ set(RTL_INCLUDE_DIRS # =============================== set(CXX_EXE_NAME RTLTestRunApp) -# Add all test sources (either glob or include your src/CMakeLists.txt) file(GLOB_RECURSE TEST_SOURCES CONFIGURE_DEPENDS src/*.cpp) add_executable(${CXX_EXE_NAME} ${TEST_SOURCES}) @@ -56,8 +51,10 @@ target_link_libraries(${CXX_EXE_NAME} GTest::gtest_main ) + # =============================== # GoogleTest Integration # =============================== + include(GoogleTest) gtest_discover_tests(${CXX_EXE_NAME}) diff --git a/RTLTestRunApp/src/CMakeLists.txt b/RTLTestRunApp/src/CMakeLists.txt index e5d3fc3f..087bb12a 100644 --- a/RTLTestRunApp/src/CMakeLists.txt +++ b/RTLTestRunApp/src/CMakeLists.txt @@ -6,6 +6,7 @@ project(RTLTestRunApp) # Create a variable containing the source files for your target set(LOCAL_SOURCES_0 "${CMAKE_CURRENT_LIST_DIR}/FunctionalityTests/ClassMethodsTests.cpp" + "${CMAKE_CURRENT_LIST_DIR}/FunctionalityTests/StaticTypeCFunctionTests.cpp" "${CMAKE_CURRENT_LIST_DIR}/FunctionalityTests/ConstMethodOverloadTests.cpp" "${CMAKE_CURRENT_LIST_DIR}/FunctionalityTests/ConstructorTests.cpp" "${CMAKE_CURRENT_LIST_DIR}/FunctionalityTests/CopyConstructorTests.cpp" @@ -15,6 +16,14 @@ set(LOCAL_SOURCES_0 "${CMAKE_CURRENT_LIST_DIR}/FunctionalityTests/PerfectForwardingTests.cpp" "${CMAKE_CURRENT_LIST_DIR}/FunctionalityTests/MoveConstructorTests.cpp" "${CMAKE_CURRENT_LIST_DIR}/FunctionalityTests/ReturnValueReflectionTest.cpp" + "${CMAKE_CURRENT_LIST_DIR}/FunctionalityTests/TypeErasedReflectiveCalls/BasicTypeErasedDispatch_Function.cpp" + "${CMAKE_CURRENT_LIST_DIR}/FunctionalityTests/StaticTypeReflectiveCalls/StrictStaticTypeDispatch_Function.cpp" + "${CMAKE_CURRENT_LIST_DIR}/FunctionalityTests/TypeErasedReflectiveCalls/BasicTypeErasedDispatch_Method.cpp" + "${CMAKE_CURRENT_LIST_DIR}/FunctionalityTests/TypeErasedReflectiveCalls/BasicTypeErasedDispatch_ConstMethod.cpp" + "${CMAKE_CURRENT_LIST_DIR}/FunctionalityTests/TypeErasedReflectiveCalls/BasicTypeErasedDispatch_StaticMethod.cpp" + "${CMAKE_CURRENT_LIST_DIR}/FunctionalityTests/StaticTypeReflectiveCalls/StrictStaticTypeDispatch_Method.cpp" + "${CMAKE_CURRENT_LIST_DIR}/FunctionalityTests/StaticTypeReflectiveCalls/StrictStaticTypeDispatch_ConstMethod.cpp" + "${CMAKE_CURRENT_LIST_DIR}/FunctionalityTests/StaticTypeReflectiveCalls/StrictStaticTypeDispatch_StaticMethod.cpp" ) # Create a variable containing the source files for your target diff --git a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorObjectTest.cpp b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorObjectTest.cpp index d98723d4..58d4be4e 100644 --- a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorObjectTest.cpp +++ b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorObjectTest.cpp @@ -1,9 +1,8 @@ #include - #include +#include -#include "RTLibInterface.h" #include "CxxMirrorToJson.h" namespace @@ -116,11 +115,11 @@ namespace rtl_tests // This test demonstrates redundant function registration handling // and argument forwarding quirks for C-style strings. - TEST(CxxMirrorObjectTest, rednudent_registration__std_cstring_function) + TEST(CxxMirrorObjectTest, rednudant_registration__std_cstring_function) { auto cxxMirror = rtl::CxxMirror({ - // Redundent registrations + // Redundant registrations rtl::type().function("strlen").build(std::strlen), rtl::type().function("strlen").build(std::strlen) @@ -133,11 +132,13 @@ namespace rtl_tests std::optional cstrLen = cxxMirror.getFunction("strlen"); ASSERT_TRUE(cstrLen); + rtl::function cstrlen_fn = cstrLen->argsT().returnT<>(); + EXPECT_TRUE(cstrlen_fn); { // Case 1: normal pointer (deduces as 'const char*') const char* cstr = "Reflection Template Library C++"; - auto [err, ret] = cstrLen->bind().call(cstr); + auto [err, ret] = cstrlen_fn(cstr); ASSERT_TRUE(err == rtl::error::None); ASSERT_FALSE(ret.isEmpty()); @@ -153,8 +154,7 @@ namespace rtl_tests // Case 2: constexpr top-level const (deduces as 'const char* const&') constexpr const char* cstr = "Reflection Template Library C++"; - // Need to forward as 'const char*' - auto [err, ret] = cstrLen->bind().call(cstr); + auto [err, ret] = cstrlen_fn(cstr); ASSERT_TRUE(err == rtl::error::None); ASSERT_FALSE(ret.isEmpty()); @@ -168,8 +168,7 @@ namespace rtl_tests EXPECT_EQ(rlen, clen); } { // Case 3: string literal (deduces as const char[N], here const char[32]) - // Must explicitly forward as 'const char*'. - auto [err, ret] = cstrLen->bind().call("Reflection Template Library C++"); + auto [err, ret] = cstrlen_fn("Reflection Template Library C++"); ASSERT_TRUE(err == rtl::error::None); ASSERT_FALSE(ret.isEmpty()); @@ -185,7 +184,7 @@ namespace rtl_tests } - TEST(CxxMirrorObjectTest, redundent_registration__std_cstring_func_with_global_cstring) + TEST(CxxMirrorObjectTest, redundant_registration__std_cstring_func_with_global_cstring) { auto cxxMirror = rtl::CxxMirror({ @@ -233,7 +232,7 @@ namespace rtl_tests - TEST(CxxMirrorObjectTest, redundent_regis_with_namespace__std_cstring_func_with_global_cstring) + TEST(CxxMirrorObjectTest, redundant_regis_with_namespace__std_cstring_func_with_global_cstring) { auto cxxMirror = rtl::CxxMirror({ // Redundant registrations with different namespaces. @@ -296,7 +295,7 @@ namespace rtl_tests - TEST(CxxMirrorObjectTest, redundent_regis_with_different_names__std_cstring_func_with_global_cstring) + TEST(CxxMirrorObjectTest, redundant_regis_with_different_names__std_cstring_func_with_global_cstring) { auto cxxMirror = rtl::CxxMirror({ // Redundant registrations with different symbolic names. diff --git a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp index b340a9c0..f0969bfa 100644 --- a/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp +++ b/RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "../../CxxTestProps/inc/Date.h" #include "../../CxxTestProps/inc/Book.h" @@ -10,6 +11,7 @@ #include "../../CxxTestProps/inc/Person.h" #include "../../CxxTestProps/inc/Library.h" #include "../../CxxTestProps/inc/Complex.h" +#include "../../CxxTestProps/inc/StringOps.h" #include "../MyReflectionTests/MyReflectingType.h" #include "TestUtilsBook.h" @@ -18,7 +20,6 @@ #include "TestUtilsAnimal.h" #include "GlobalTestUtils.h" -#include "RTLibInterface.h" #include "CxxMirrorThreadingTest.h" using namespace test_utils; diff --git a/RTLTestRunApp/src/FunctionalityTests/ClassMethodsTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ClassMethodsTests.cpp index ffd62a06..54cc1f7b 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ClassMethodsTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ClassMethodsTests.cpp @@ -1,3 +1,5 @@ + +#include #include #include "TestMirrorProvider.h" @@ -33,7 +35,7 @@ namespace rtl_tests for (const auto& itr1 : namespaceRecordMap) { const std::string& recordName = itr1.first; - const std::size_t recordId = reflected_id::getRecordIdFor(recordName); + const std::size_t recordId = cxx::reflected_id(recordName); const auto& itr = rtl_recordIdMap.find(recordId); ASSERT_TRUE(itr != rtl_recordIdMap.end()); @@ -82,7 +84,7 @@ namespace rtl_tests ASSERT_FALSE(book.isEmpty()); EXPECT_FALSE(setAuthor->hasSignature()); - auto [err1, ret] = (*setAuthor)(book)(book::AUTHOR); + auto [err1, ret] = setAuthor->bind(book).call(book::AUTHOR); EXPECT_TRUE(err1 == error::SignatureMismatch); ASSERT_TRUE(ret.isEmpty()); @@ -108,7 +110,7 @@ namespace rtl_tests ASSERT_FALSE(book.isEmpty()); EXPECT_FALSE(setAuthor->hasSignature()); - auto [err1, ret] = (*setAuthor)(book)(book::AUTHOR); + auto [err1, ret] = setAuthor->bind(book).call(book::AUTHOR); EXPECT_TRUE(err1 == error::SignatureMismatch); ASSERT_TRUE(ret.isEmpty()); @@ -133,8 +135,8 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); EXPECT_TRUE(getPublishedOn->hasSignature<>()); //empty template params checks for zero arguments. - // Slower. bind<>().call() syntax is faster. - auto [err1, ret] = (*getPublishedOn)(book)(); + + auto [err1, ret] = getPublishedOn->bind(book).call(); EXPECT_TRUE(err1 == error::None); ASSERT_FALSE(ret.isEmpty()); @@ -163,7 +165,7 @@ namespace rtl_tests ASSERT_FALSE(book.isEmpty()); EXPECT_TRUE(getPublishedOn->hasSignature<>()); //empty template params checks for zero arguments. - auto [err1, ret] = (*getPublishedOn)(book)(); + auto [err1, ret] = getPublishedOn->bind(book).call(); EXPECT_TRUE(err1 == error::None); ASSERT_FALSE(ret.isEmpty()); @@ -246,7 +248,7 @@ namespace rtl_tests ASSERT_FALSE(book.isEmpty()); EXPECT_TRUE(updateBookInfo->hasSignature<>()); //empty template params checks for zero arguments. - auto [err1, ret] = (*updateBookInfo)(book)(); + auto [err1, ret] = updateBookInfo->bind(book).call(); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret.isEmpty()); @@ -272,7 +274,7 @@ namespace rtl_tests ASSERT_FALSE(book.isEmpty()); EXPECT_TRUE(updateBookInfo->hasSignature<>()); //empty template params checks for zero arguments. - auto [err1, ret] = (*updateBookInfo)(book)(); + auto [err1, ret] = updateBookInfo->bind(book).call(); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret.isEmpty()); @@ -304,7 +306,7 @@ namespace rtl_tests std::string author = book::AUTHOR; const char* title = book::TITLE; - auto [err1, ret] = (*updateBookInfo)(book)(author, price, title); + auto [err1, ret] = updateBookInfo->bind(book).call(author, price, title); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret.isEmpty()); @@ -338,7 +340,7 @@ namespace rtl_tests std::string author = book::AUTHOR; const char* title = book::TITLE; - auto [err1, ret] = (*updateBookInfo)(book)(author, price, title); + auto [err1, ret] = updateBookInfo->bind(book).call(author, price, title); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret.isEmpty()); @@ -372,7 +374,7 @@ namespace rtl_tests std::string author = book::AUTHOR; const char* title = book::TITLE; - auto [err1, ret] = (*updateBookInfo)(book)(title, price, author); + auto [err1, ret] = updateBookInfo->bind(book).call(title, price, author); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret.isEmpty()); @@ -406,7 +408,7 @@ namespace rtl_tests std::string author = book::AUTHOR; const char* title = book::TITLE; - auto [err1, ret] = (*updateBookInfo)(book)(title, price, author); + auto [err1, ret] = updateBookInfo->bind(book).call(title, price, author); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret.isEmpty()); @@ -438,7 +440,7 @@ namespace rtl_tests //actual signature is 'const string', but we are passing 'string' as argument. which resolves to right call. //as long as any param_type in signature is not reference, const-qualifier do not matter. - auto [err1, ret] = (*addCopyrightTag)(book)(std::string(book::COPYRIGHT_TAG)); + auto [err1, ret] = addCopyrightTag->bind(book).call(std::string(book::COPYRIGHT_TAG)); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret.isEmpty()); @@ -470,7 +472,7 @@ namespace rtl_tests //actual signature is 'const string', but we are passing 'string' as argument. which resolves to right call. //as long as any param_type in signature is not reference, const-qualifier do not matter. - auto [err1, ret] = (*addCopyrightTag)(book)(std::string(book::COPYRIGHT_TAG)); + auto [err1, ret] = addCopyrightTag->bind(book).call(std::string(book::COPYRIGHT_TAG)); EXPECT_TRUE(err1 == error::None); ASSERT_TRUE(ret.isEmpty()); diff --git a/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp index 87ba39ce..9054c390 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ConstMethodOverloadTests.cpp @@ -1,3 +1,5 @@ + +#include #include #include "TestMirrorProvider.h" @@ -177,13 +179,13 @@ namespace rtl_tests EXPECT_TRUE(updateLastName->hasSignature()); { string_view lastName = "invalid_arg"; - auto [err, ret] = (*updateLastName)(person)(lastName); + auto [err, ret] = updateLastName->bind(person).call(lastName); EXPECT_TRUE(err == error::SignatureMismatch); ASSERT_TRUE(ret.isEmpty()); } { string lastName = person::LAST_NAME; - auto [err, ret] = (*updateLastName)(person)(lastName); + auto [err, ret] = updateLastName->bind(person).call(lastName); EXPECT_TRUE(err == error::None); ASSERT_TRUE(ret.isEmpty()); @@ -214,13 +216,13 @@ namespace rtl_tests EXPECT_TRUE(updateLastName->hasSignature()); { string_view lastName = "invalid_arg"; - auto [err, ret] = (*updateLastName)(person)(lastName); + auto [err, ret] = updateLastName->bind(person).call(lastName); EXPECT_TRUE(err == error::SignatureMismatch); ASSERT_TRUE(ret.isEmpty()); } { string lastName = person::LAST_NAME; - auto [err, ret] = (*updateLastName)(person)(lastName); + auto [err, ret] = updateLastName->bind(person).call(lastName); EXPECT_TRUE(err == error::None); ASSERT_TRUE(ret.isEmpty()); diff --git a/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp index 66ad00e4..9255e4d2 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ConstructorTests.cpp @@ -1,3 +1,5 @@ + +#include #include #include "TestMirrorProvider.h" diff --git a/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp b/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp index a0de7709..7fcab755 100644 --- a/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/CopyConstructorTests.cpp @@ -1,3 +1,5 @@ + +#include #include #include "TestMirrorProvider.h" @@ -126,10 +128,10 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - auto [err1, ret1] = (*setAuthor)(book)(author); + auto [err1, ret1] = setAuthor->bind(book).call(author); EXPECT_TRUE(err1 == error::None); - auto [err2, ret2] = (*setDecription)(book)(description); + auto [err2, ret2] = setDecription->bind(book).call(description); EXPECT_TRUE(err1 == error::None); auto [err3, bookCopy] = book.clone(); @@ -168,10 +170,10 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - auto [err1, ret1] = (*setAuthor)(book)(author); + auto [err1, ret1] = setAuthor->bind(book).call(author); EXPECT_TRUE(err1 == error::None); - auto [err2, ret2] = (*setDecription)(book)(description); + auto [err2, ret2] = setDecription->bind(book).call(description); EXPECT_TRUE(err1 == error::None); auto [err3, bookCopy] = book.clone(); @@ -210,10 +212,10 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - auto [err1, ret1] = (*setAuthor)(book)(author); + auto [err1, ret1] = setAuthor->bind(book).call(author); EXPECT_TRUE(err1 == error::None); - auto [err2, ret2] = (*setDecription)(book)(description); + auto [err2, ret2] = setDecription->bind(book).call(description); EXPECT_TRUE(err1 == error::None); auto [err3, bookCopy] = book.clone(); @@ -252,10 +254,10 @@ namespace rtl_tests EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(book.isEmpty()); - auto [err1, ret1] = (*setAuthor)(book)(author); + auto [err1, ret1] = setAuthor->bind(book).call(author); EXPECT_TRUE(err1 == error::None); - auto [err2, ret2] = (*setDecription)(book)(description); + auto [err2, ret2] = setDecription->bind(book).call(description); EXPECT_TRUE(err1 == error::None); auto [err3, bookCopy] = book.clone(); diff --git a/RTLTestRunApp/src/FunctionalityTests/MoveConstructorTests.cpp b/RTLTestRunApp/src/FunctionalityTests/MoveConstructorTests.cpp index d4c07bc0..36f687f0 100644 --- a/RTLTestRunApp/src/FunctionalityTests/MoveConstructorTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/MoveConstructorTests.cpp @@ -1,4 +1,5 @@ +#include #include #include "TestMirrorProvider.h" @@ -228,7 +229,7 @@ namespace rtl_tests // Calender::create is a static method that returns stack-allocated Calender object. // Calling this via reflection, moves the return value from Calender::create to here. - auto [err0, calender0] = (*createCalender)()(); + auto [err0, calender0] = createCalender->bind().call(); EXPECT_TRUE(err0 == error::None); ASSERT_FALSE(calender0.isEmpty()); diff --git a/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp b/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp index 705e5beb..a7afb80c 100644 --- a/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp @@ -1,7 +1,9 @@ -#include +#include #include +#include + #include "TestMirrorProvider.h" #include "GlobalTestUtils.h" @@ -16,7 +18,7 @@ namespace rtl_tests TEST(Reflecting_pod, construct_char_on_heap_and_stack) { - optional charType = cxx::mirror().getRecord(reflected_id::char_t); + optional charType = cxx::mirror().getRecord(cxx::reflected_id("char")); ASSERT_TRUE(charType); { /* Attempting to construct a POD type('char') with a value directly via Record::create<>(). @@ -144,7 +146,7 @@ namespace rtl_tests double real = g_real; //g_real's type is "const double", so can't be passed directly to setReal else, //its type will be inferred 'const double' instead of 'double'. - auto [err0, ret0] = (*setReal)(real); + auto [err0, ret0] = setReal->bind().call(real); EXPECT_TRUE(err0 == rtl::error::None); ASSERT_TRUE(ret0.isEmpty()); @@ -152,13 +154,13 @@ namespace rtl_tests double imaginary = g_imaginary; //g_imaginary's type is "const double", so can't be passed directly to setImaginary else, //its type will be inferred 'const double' instead of 'double'. - auto [err1, ret1] = (*setImaginary)(imaginary); + auto [err1, ret1] = setImaginary->bind().call(imaginary); EXPECT_TRUE(err1 == rtl::error::None); ASSERT_TRUE(ret1.isEmpty()); EXPECT_TRUE(getMagnitude->hasSignature<>()); //empty template params checks for zero arguments. - auto [err2, ret2] = (*getMagnitude)(); + auto [err2, ret2] = getMagnitude->bind().call(); EXPECT_TRUE(err2 == rtl::error::None); ASSERT_FALSE(ret2.isEmpty()); @@ -172,19 +174,17 @@ namespace rtl_tests TEST(FunctionInNameSpace, execute_with_wrong_signature) { - optional setReal = cxx::mirror().getFunction(str_complex, str_setReal); - ASSERT_TRUE(setReal); + optional setRealOpt = cxx::mirror().getFunction(str_complex, str_setReal); + ASSERT_TRUE(setRealOpt); - EXPECT_TRUE(setReal->hasSignature()); - EXPECT_FALSE(setReal->hasSignature()); + EXPECT_TRUE(setRealOpt->hasSignature()); + EXPECT_FALSE(setRealOpt->hasSignature()); - //g_real's type is "const double", so can't be passed directly to setReal. - //Instead we can explicitly specify the types as template parameter, - //like, (*setReal).operator()(g_real); - //or we can use the bind<...>().call(), specifying type as template param, like, - auto [err, robj] = setReal->bind().call(g_real); + rtl::function setReal_bad_fn = setRealOpt->argsT().returnT<>(); + EXPECT_FALSE(setReal_bad_fn); - EXPECT_TRUE(err == rtl::error::SignatureMismatch); + auto [err, robj] = setReal_bad_fn(g_real); + EXPECT_EQ(err, rtl::error::InvalidCaller); ASSERT_TRUE(robj.isEmpty()); } @@ -194,7 +194,7 @@ namespace rtl_tests optional getComplexNumAsString = cxx::mirror().getFunction(str_getComplexNumAsString); ASSERT_TRUE(getComplexNumAsString); - auto [err, ret] = (*getComplexNumAsString)(); + auto [err, ret] = getComplexNumAsString->bind().call(); EXPECT_TRUE(err == rtl::error::None); ASSERT_FALSE(ret.isEmpty()); @@ -208,37 +208,45 @@ namespace rtl_tests TEST(GlobalFunction, overloaded_function_execute_return) { - optional reverseString = cxx::mirror().getFunction(str_reverseString); + optional reverseStringOpt = cxx::mirror().getFunction(str_reverseString); + ASSERT_TRUE(reverseStringOpt); + + rtl::function reverseString = reverseStringOpt->argsT().returnT<>(); ASSERT_TRUE(reverseString); { - //STRA's type is 'consexpr const char*', function accepts 'string', + //STRA's type is 'const char*', function accepts 'string', //so type-casting in place as 'string' - auto [err, ret] = (*reverseString)(string(STRA)); + auto [err, ret] = reverseString(STRA); EXPECT_TRUE(err == rtl::error::None); ASSERT_FALSE(ret.isEmpty()); EXPECT_TRUE(ret.canViewAs()); - string retVal = ret.view()->get(); - EXPECT_TRUE(retVal == STRA_REVERSE); + string retStr = ret.view()->get(); + auto expStr = std::string(STRA_REVERSE) + SUFFIX_std_string; + EXPECT_EQ(retStr, expStr); } { - //STRB's type is 'consexpr const char*', function accepts 'string', + //STRB's type is 'const char*', function accepts 'string', //so explicitly binding type in template (using bind<...>()) to enforce the type as 'string'. - auto [err, ret] = reverseString->bind().call(STRB); + auto [err, ret] = reverseString(STRB); EXPECT_TRUE(err == rtl::error::None); ASSERT_FALSE(ret.isEmpty()); EXPECT_TRUE(ret.canViewAs()); - string retVal = ret.view()->get(); - EXPECT_TRUE(retVal == STRB_REVERSE); + string retStr = ret.view()->get(); + auto expStr = std::string(STRB_REVERSE) + SUFFIX_std_string; + EXPECT_EQ(retStr, expStr); } { - auto [err, ret] = (*reverseString)(); + rtl::function reverseStr = reverseStringOpt->argsT<>().returnT<>(); + + auto [err, ret] = reverseStr(); EXPECT_TRUE(err == rtl::error::None); ASSERT_FALSE(ret.isEmpty()); EXPECT_TRUE(ret.canViewAs()); - string retVal = ret.view()->get(); - EXPECT_TRUE(retVal == REV_STR_VOID_RET); + string retStr = ret.view()->get(); + auto expStr = std::string(REV_STR_VOID_RET) + SUFFIX_void; + EXPECT_EQ(retStr, expStr); } } diff --git a/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp b/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp index ac4dd880..77ffc81a 100644 --- a/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/PerfectForwardingTests.cpp @@ -16,6 +16,8 @@ * - `RObject`: A type-erased wrapper for return values and objects created via reflection, ensuring proper memory management. */ + +#include #include #include "TestMirrorProvider.h" @@ -321,8 +323,11 @@ namespace rtl_tests const auto& isValid = updateZooKeeper->hasSignature(); EXPECT_TRUE(isValid); - const auto zookeeper = std::string(animal::ZOO_KEEPER); - auto [err, ret] = updateZooKeeper->bind().call(zookeeper); + rtl::static_method updateZooKeeperMth = updateZooKeeper.value() + .argsT() + .returnT<>(); + + auto [err, ret] = updateZooKeeperMth.bind()(animal::ZOO_KEEPER); EXPECT_TRUE(err == error::None); ASSERT_FALSE(ret.isEmpty()); @@ -349,8 +354,10 @@ namespace rtl_tests const auto& isValid = updateZooKeeper->hasSignature(); EXPECT_TRUE(isValid); - auto zookeeper = std::string(animal::ZOO_KEEPER); - auto [err, ret] = updateZooKeeper->bind().call(zookeeper); + rtl::static_method updateZooKeeperMth = updateZooKeeper.value() + .argsT() + .returnT<>(); + auto [err, ret] = updateZooKeeperMth.bind()(animal::ZOO_KEEPER); EXPECT_TRUE(err == error::None); ASSERT_FALSE(ret.isEmpty()); diff --git a/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp b/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp index 0fbbd762..469718c4 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ReflectionOpErrorCodeTests.cpp @@ -7,6 +7,10 @@ * rtl::error::ConstOverloadMissing * rtl::error::NonConstOverloadMissing * rtl::error::ConstCallViolation +* +* Covered in ReturnTypeErasedDispatch.cpp +* rtl::error::ExplicitRefBindingRequired +* * and, * rtl::error::FunctionNotRegistered, is not internally used by RTL. * Function/Method objects are returned wrapped in std::optional<>, which will @@ -14,6 +18,8 @@ * */ + +#include #include #include "TestMirrorProvider.h" diff --git a/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp b/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp index 61bc03ed..76ecdecf 100644 --- a/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/ReturnValueReflectionTest.cpp @@ -1,10 +1,9 @@ +#include #include #include "TestMirrorProvider.h" #include "TestUtilsDate.h" -//#include "TestUtilsBook.h" -//#include "GlobalTestUtils.h" using namespace test_utils; using namespace test_mirror; @@ -14,7 +13,7 @@ namespace rtl_tests TEST(ReflecetdReturnValues, on_registered_return_type__test_cloning) { //I don't know if the 'Event' is class or struct..Reflection YaY!. :P - auto classEvent = cxx::mirror().getRecord(reflected_id::event); + auto classEvent = cxx::mirror().getRecord(cxx::reflected_id(event::struct_)); ASSERT_TRUE(classEvent); auto [err0, robj0] = classEvent->create(); @@ -23,7 +22,7 @@ namespace rtl_tests EXPECT_TRUE(err0 == rtl::error::TypeNotDefaultConstructible); ASSERT_TRUE(robj0.isEmpty()); { - auto classCalender = cxx::mirror().getRecord(reflected_id::calender); + auto classCalender = cxx::mirror().getRecord(cxx::reflected_id(calender::struct_)); ASSERT_TRUE(classCalender); auto [err1, calender] = classCalender->create(); @@ -44,7 +43,7 @@ namespace rtl_tests auto [err2, event] = getEvent->bind(calender).call(); EXPECT_TRUE(err2 == rtl::error::None); ASSERT_FALSE(event.isEmpty()); - EXPECT_TRUE(event.getTypeId() == reflected_id::event); + EXPECT_TRUE(event.getTypeId() == cxx::reflected_id(event::struct_)); { { auto [err, robj] = event.clone(); diff --git a/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp b/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp index 5d93608f..f28536a4 100644 --- a/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp +++ b/RTLTestRunApp/src/FunctionalityTests/StaticMethodTests.cpp @@ -1,4 +1,5 @@ +#include #include #include "TestMirrorProvider.h" @@ -21,7 +22,7 @@ namespace rtl_tests ASSERT_TRUE(getDefaults); EXPECT_TRUE(getDefaults->hasSignature<>()); //empty template params checks for zero arguments. - auto [err, ret] = (*getDefaults)()(); + auto [err, ret] = getDefaults->bind().call(); EXPECT_TRUE(err == error::None); ASSERT_FALSE(ret.isEmpty()); EXPECT_TRUE(ret.canViewAs()); @@ -59,7 +60,7 @@ namespace rtl_tests ASSERT_TRUE(getProfile); EXPECT_TRUE(getProfile->hasSignature()); { - auto [err, ret] = (*getProfile)()(true); + auto [err, ret] = getProfile->bind().call(true); EXPECT_TRUE(err == error::None); ASSERT_FALSE(ret.isEmpty()); EXPECT_TRUE(ret.canViewAs()); @@ -112,25 +113,30 @@ namespace rtl_tests optional classPerson = cxx::mirror().getRecord(person::class_); ASSERT_TRUE(classPerson); - optional getDefaults = classPerson->getMethod(person::str_getDefaults); - ASSERT_TRUE(getDefaults); - EXPECT_TRUE(getDefaults->hasSignature<>()); //empty template params checks for zero arguments. + optional getDefaultsOpt = classPerson->getMethod(person::str_getDefaults); + ASSERT_TRUE(getDefaultsOpt); + EXPECT_TRUE(getDefaultsOpt->hasSignature<>()); //empty template params checks for zero arguments. + { + rtl::method getDefaults = getDefaultsOpt.value().targetT().argsT().returnT(); - auto [err0, person] = classPerson->create(); + EXPECT_FALSE(getDefaults); + EXPECT_EQ(getDefaults.get_init_error(), error::InvalidStaticMethodCaller); - EXPECT_TRUE(err0 == error::None); - ASSERT_FALSE(person.isEmpty()); - { - auto [err, ret] = (*getDefaults)(person)(); - EXPECT_TRUE(err == error::None); - ASSERT_FALSE(ret.isEmpty()); - EXPECT_TRUE(ret.canViewAs()); + auto [err0, person] = classPerson->create(); - auto& retStr = ret.view()->get(); - EXPECT_EQ(retStr, person::get_str_returned_on_call_getDefaults()); + EXPECT_EQ(err0, error::None); + ASSERT_FALSE(person.isEmpty()); + + auto [err, ret] = getDefaults(person)(); + + EXPECT_EQ(err, error::InvalidStaticMethodCaller); + EXPECT_TRUE(ret.isEmpty()); } { - auto [err, ret] = getDefaults->bind(person).call(); - EXPECT_TRUE(err == error::None); + rtl::static_method getDefaults = getDefaultsOpt.value().argsT().returnT(); + + auto [err, ret] = getDefaults(); + + EXPECT_EQ(err, error::None); ASSERT_FALSE(ret.isEmpty()); EXPECT_TRUE(ret.canViewAs()); @@ -145,38 +151,39 @@ namespace rtl_tests optional classPerson = cxx::mirror().getRecord(person::class_); ASSERT_TRUE(classPerson); - auto [err0, person] = classPerson->create(); + optional getProfileOpt = classPerson->getMethod(person::str_getProfile); + ASSERT_TRUE(getProfileOpt); + EXPECT_TRUE((getProfileOpt->hasSignature())); - EXPECT_TRUE(err0 == error::None); - ASSERT_FALSE(person.isEmpty()); - - optional getProfile = classPerson->getMethod(person::str_getProfile); - ASSERT_TRUE(getProfile); - EXPECT_TRUE((getProfile->hasSignature())); - - size_t age = person::AGE; - string occupation = person::OCCUPATION; { - auto [err, ret] = getProfile->bind(person).call(occupation, age); + rtl::method getProfile = getProfileOpt.value() + .targetT() + .argsT() + .returnT(); + EXPECT_FALSE(getProfile); + EXPECT_EQ(getProfile.get_init_error(), error::InvalidStaticMethodCaller); - EXPECT_TRUE(err == error::None); - ASSERT_FALSE(ret.isEmpty()); - EXPECT_TRUE(ret.canViewAs()); + auto [err0, person] = classPerson->create(); - const string& retStr = ret.view()->get(); - const string& checkStr = person::get_str_returned_on_call_getProfile(); + EXPECT_EQ(err0, error::None); + ASSERT_FALSE(person.isEmpty()); - EXPECT_EQ(retStr, checkStr); + auto [err, ret] = getProfile(person)(person::OCCUPATION, person::AGE); + + EXPECT_EQ(err, error::InvalidStaticMethodCaller); + ASSERT_TRUE(ret.isEmpty()); } { - auto [err, ret] = (*getProfile)(person)(occupation, age); + rtl::static_method getProfile = getProfileOpt.value() + .argsT() + .returnT(); + auto [err, ret] = getProfile(person::OCCUPATION, person::AGE); - EXPECT_TRUE(err == error::None); + EXPECT_EQ(err, error::None); ASSERT_FALSE(ret.isEmpty()); EXPECT_TRUE(ret.canViewAs()); const string& retStr = ret.view()->get(); const string& checkStr = person::get_str_returned_on_call_getProfile(); - EXPECT_EQ(retStr, checkStr); } } diff --git a/RTLTestRunApp/src/FunctionalityTests/StaticTypeReflectiveCalls/StrictStaticTypeDispatch_ConstMethod.cpp b/RTLTestRunApp/src/FunctionalityTests/StaticTypeReflectiveCalls/StrictStaticTypeDispatch_ConstMethod.cpp new file mode 100644 index 00000000..caa358e2 --- /dev/null +++ b/RTLTestRunApp/src/FunctionalityTests/StaticTypeReflectiveCalls/StrictStaticTypeDispatch_ConstMethod.cpp @@ -0,0 +1,408 @@ + +#include +#include + +#include "TestMirrorProvider.h" +#include "GlobalTestUtils.h" +#include "../CxxTestProps/inc/StringOps.h" + +using namespace test_utils; +using namespace test_mirror; + +namespace rtl_tests +{ + TEST(StrictStaticTypeRtl_const_method, std_string_view_method_call_with_known_signature) + { + std::optional stdStringViewClass = cxx::mirror().getRecord("std", "string_view"); + ASSERT_TRUE(stdStringViewClass); + + std::optional isStringEmpty = stdStringViewClass->getMethod("empty"); + ASSERT_TRUE(isStringEmpty); + { + rtl::method is_empty = isStringEmpty->targetT() + .argsT<>() + .returnT(); + EXPECT_FALSE(is_empty); + } { + rtl::method is_empty = isStringEmpty->targetT() + .argsT<>() + .returnT(); + ASSERT_TRUE(is_empty); + + EXPECT_TRUE(is_empty(std::string(""))()); + + EXPECT_FALSE(is_empty(std::string("not_empty"))()); + + EXPECT_TRUE(is_empty(std::string_view(""))()); + + EXPECT_FALSE(is_empty(std::string_view("view_not_empty"))()); + + EXPECT_TRUE(is_empty("")()); + + EXPECT_FALSE(is_empty("view_not_empty")()); + } + } + + + TEST(StrictStaticTypeRtl_const_method, overload_resolution_with_known_signatures) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrConst::struct_); + ASSERT_TRUE(optStringUtil); + + std::optional reverseString = optStringUtil->getMethod(str_reverseString); + ASSERT_TRUE(reverseString); + { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + EXPECT_FALSE(reverse_string); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + EXPECT_FALSE(reverse_string); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + EXPECT_FALSE(reverse_string); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + EXPECT_FALSE(reverse_string); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(StrConst())(STRA); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_const_char_ptr + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(StrConst())(STRB); + auto exp_str = std::string(STRB_REVERSE) + SUFFIX_std_string + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT<>() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(StrConst())(); + auto exp_str = std::string(REV_STR_VOID_RET) + SUFFIX_void + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_const_method, lvalue_ref_overload_resolution_with_known_signatures) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrConst::struct_); + ASSERT_TRUE(optStringUtil); + + std::optional reverseString = optStringUtil->getMethod(str_reverseString); + ASSERT_TRUE(reverseString); + { + //argument lvalue-ref. + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + //non-const target + StrConst target; + std::string lv_str = STRA; + std::string ret_str = reverse_string(target)(lv_str); + + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_lvref + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } { + //argument const-lvalue-ref. + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + //non-const target + StrConst target; + const std::string lv_str = STRA; + std::string ret_str = reverse_string(target)(lv_str); + + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_clvref + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } { + //argument lvalue-ref. + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + //const target. + const StrConst target; + std::string lv_str = STRA; + std::string ret_str = reverse_string(target)(lv_str); + + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_lvref + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } { + //argument const-lvalue-ref. + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + //const target. + const StrConst target; + const std::string lv_str = STRA; + std::string ret_str = reverse_string(target)(lv_str); + + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_clvref + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_const_method, rvalue_ref_overload_resolution_with_known_signatures) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrConst::struct_); + ASSERT_TRUE(optStringUtil); + + + std::optional reverseString = optStringUtil->getMethod(str_reverseString); + ASSERT_TRUE(reverseString); + { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + { + //non-const target. + StrConst target; + std::string ret_str = reverse_string(target)(STRA); + + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_rvref + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } { + //const-target + const StrConst target; + std::string ret_str = reverse_string(target)(STRA); + + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_rvref + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + EXPECT_FALSE(reverse_string); + } + } + + + TEST(StrictStaticTypeRtl_const_method, ptr_and_const_ptr_overload_resolution_with_known_signatures) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrConst::struct_); + ASSERT_TRUE(optStringUtil); + + StrConst target; + std::string str = STRA; + std::optional reverseString = optStringUtil->getMethod(str_reverseString); + ASSERT_TRUE(reverseString); + { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(target)(&str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_ptr + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(target)(&str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_cptr + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_const_method, std_string_method_call_with_known_signature) + { + std::optional stdStringClass = cxx::mirror().getRecord("std", "string"); + ASSERT_TRUE(stdStringClass); + + std::optional isStringEmpty = stdStringClass->getMethod("empty"); + ASSERT_TRUE(isStringEmpty); + { + rtl::method is_empty = isStringEmpty->targetT() + .argsT<>() + .returnT(); + EXPECT_FALSE(is_empty); + } { + rtl::method is_empty = isStringEmpty->targetT() + .argsT<>() + .returnT(); + ASSERT_TRUE(is_empty); + + EXPECT_TRUE(is_empty(std::string(""))()); + + EXPECT_FALSE(is_empty(std::string("not_empty"))()); + + EXPECT_TRUE(is_empty("")()); + + EXPECT_FALSE(is_empty("view_not_empty")()); + } + } + + + TEST(StrictStaticTypeRtl_const_method, distinct_functions_with_ref_args_call_with_known_signature) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrConst::struct_); + ASSERT_TRUE(optStringUtil); + + StrConst target; + std::string str = STRA; + { + std::optional reverseString = optStringUtil->getMethod(str_revStrConstRefArg); + ASSERT_TRUE(reverseString); + + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + StrConst target; + std::string ret_str = reverse_string(target)(str); + + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } { + std::optional reverseString = optStringUtil->getMethod(str_revStrNonConstRefArg); + ASSERT_TRUE(reverseString); + + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + auto lvstr = std::string_view(str); + std::string ret_str = reverse_string(target)(lvstr); + + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } { + std::optional reverseString = optStringUtil->getMethod(str_revStrRValueRefArg); + ASSERT_TRUE(reverseString); + + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(target)(std::string_view(str)); + + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_rvref + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_const_method, overloads_with_ref_and_value_args_call_with_known_signature) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrConst::struct_); + ASSERT_TRUE(optStringUtil); + + StrConst target; + std::optional reverseString = optStringUtil->getMethod(str_revStrOverloadValRef); + ASSERT_TRUE(reverseString); + { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(target)(std::string_view(STRA)); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string_view str = STRA; + std::string ret_str = reverse_string(target)(str); + + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_const_method, overloads_with_const_ref_and_value_args_call_with_known_signature) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrConst::struct_); + ASSERT_TRUE(optStringUtil); + + StrConst target; + std::optional reverseString = optStringUtil->getMethod(str_revStrOverloadValCRef); + ASSERT_TRUE(reverseString); + { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(target)(std::string_view(STRA)); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(target)(std::string_view(STRA)); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_const_method, overloads_with_ref_and_const_ref_args_call_with_known_signature) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrConst::struct_); + ASSERT_TRUE(optStringUtil); + + StrConst target; + std::optional reverseString = optStringUtil->getMethod(str_revStrOverloadValRefAndCRef); + ASSERT_TRUE(reverseString); + { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string_view str = STRA; + std::string ret_str = reverse_string(target)(str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(target)(std::string_view(STRA)); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref + SUFFIX_const; + EXPECT_EQ(ret_str, exp_str); + } + } +} \ No newline at end of file diff --git a/RTLTestRunApp/src/FunctionalityTests/StaticTypeReflectiveCalls/StrictStaticTypeDispatch_Function.cpp b/RTLTestRunApp/src/FunctionalityTests/StaticTypeReflectiveCalls/StrictStaticTypeDispatch_Function.cpp new file mode 100644 index 00000000..93bdb379 --- /dev/null +++ b/RTLTestRunApp/src/FunctionalityTests/StaticTypeReflectiveCalls/StrictStaticTypeDispatch_Function.cpp @@ -0,0 +1,305 @@ + +#include +#include +#include + +#include "TestMirrorProvider.h" +#include "GlobalTestUtils.h" + + +using namespace test_utils; +using namespace test_mirror; + +namespace rtl_tests +{ + TEST(StrictStaticTypeRtl_function, namespace_fn_validation_with_known_signature) + { + std::optional setReal = cxx::mirror().getFunction(str_complex, str_setReal); + ASSERT_TRUE(setReal); + { + EXPECT_TRUE(setReal->getNamespace() == str_complex); + EXPECT_TRUE(setReal->getFunctionName() == str_setReal); + { + rtl::function functor = setReal->argsT().returnT(); + EXPECT_TRUE(functor); + } { + rtl::function functor = setReal->argsT().returnT(); + EXPECT_FALSE(functor); + } + } + + std::optional setImaginary = cxx::mirror().getFunction(str_complex, str_setImaginary); + ASSERT_TRUE(setImaginary); + { + EXPECT_TRUE(setImaginary->getNamespace() == str_complex); + EXPECT_TRUE(setImaginary->getFunctionName() == str_setImaginary); + { + rtl::function functor = setImaginary->argsT().returnT(); + EXPECT_TRUE(functor); + } { + rtl::function functor = setImaginary->argsT().returnT(); + EXPECT_FALSE(functor); + } + } + } + + + TEST(StrictStaticTypeRtl_function, namespace_fn_call_with_known_signature) + { + std::optional getMagnitude = cxx::mirror().getFunction(str_complex, str_getMagnitude); + ASSERT_TRUE(getMagnitude); + + rtl::function get_magnitude = getMagnitude->argsT<>().returnT(); + ASSERT_TRUE(get_magnitude); + + std::optional setReal = cxx::mirror().getFunction(str_complex, str_setReal); + ASSERT_TRUE(setReal); + + rtl::function set_real = setReal->argsT().returnT(); + ASSERT_TRUE(set_real); + + std::optional setImaginary = cxx::mirror().getFunction(str_complex, str_setImaginary); + ASSERT_TRUE(setImaginary); + + rtl::function set_imaginary = setImaginary->argsT().returnT(); + ASSERT_TRUE(set_imaginary); + + set_real(g_real); + set_imaginary(g_imaginary); + + double retVal = get_magnitude(); + + double magnitude = abs(std::complex(g_real, g_imaginary)); + + EXPECT_DOUBLE_EQ(magnitude, retVal); + } + + + TEST(StrictStaticTypeRtl_function, global_fn_call_with_known_signature) + { + std::optional getComplexNumStr = cxx::mirror().getFunction(str_getComplexNumAsString); + ASSERT_TRUE(getComplexNumStr); + { + rtl::function get_complex_num_str = getComplexNumStr->argsT<>().returnT(); + EXPECT_FALSE(get_complex_num_str); + } { + rtl::function get_complex_num_str = getComplexNumStr->argsT<>().returnT(); + EXPECT_FALSE(get_complex_num_str); + } { + rtl::function get_complex_num_str = getComplexNumStr->argsT<>().returnT(); + ASSERT_TRUE(get_complex_num_str); + + std::string ret_str = get_complex_num_str(); + + std::string complex_num_str = std::to_string(g_real) + "i" + std::to_string(g_imaginary); + + EXPECT_EQ(complex_num_str, ret_str); + } + } + + + TEST(StrictStaticTypeRtl_function, overload_resolution_with_known_signatures) + { + std::optional reverseString = cxx::mirror().getFunction(str_reverseString); + ASSERT_TRUE(reverseString); + { + rtl::function reverse_string = reverseString->argsT().returnT(); + EXPECT_FALSE(reverse_string); + } { + rtl::function reverse_string = reverseString->argsT().returnT(); + EXPECT_FALSE(reverse_string); + } { + rtl::function reverse_string = reverseString->argsT().returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(STRA); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_const_char_ptr; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::function reverse_string = reverseString->argsT().returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(STRB); + auto exp_str = std::string(STRB_REVERSE) + SUFFIX_std_string; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::function reverse_string = reverseString->argsT<>().returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(); + auto exp_str = std::string(REV_STR_VOID_RET) + SUFFIX_void; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_function, lvalue_ref_overload_resolution_with_known_signatures) + { + std::optional reverseString = cxx::mirror().getFunction(str_reverseString); + ASSERT_TRUE(reverseString); + { + rtl::function reverse_string = reverseString->argsT().returnT(); + ASSERT_TRUE(reverse_string); + + std::string lv_str = STRA; + std::string ret_str = reverse_string(lv_str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_lvref; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::function reverse_string = reverseString->argsT().returnT(); + ASSERT_TRUE(reverse_string); + + const std::string lv_str = STRA; + std::string ret_str = reverse_string(lv_str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_clvref; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_function, rvalue_ref_overload_resolution_with_known_signatures) + { + std::optional reverseString = cxx::mirror().getFunction(str_reverseString); + ASSERT_TRUE(reverseString); + { + rtl::function reverse_string = reverseString->argsT().returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(STRA); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_rvref; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::function reverse_string = reverseString->argsT().returnT(); + EXPECT_FALSE(reverse_string); + } + } + + + TEST(StrictStaticTypeRtl_function, ptr_and_const_ptr_overload_resolution_with_known_signatures) + { + std::string str = STRA; + std::optional reverseString = cxx::mirror().getFunction(str_reverseString); + ASSERT_TRUE(reverseString); + { + rtl::function reverse_string = reverseString->argsT().returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(&str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_ptr; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::function reverse_string = reverseString->argsT().returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(&str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_cptr; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_function, distinct_functions_with_ref_args_call_with_known_signature) + { + std::string str = STRA; + { + std::optional reverseString = cxx::mirror().getFunction(str_revStrConstRefArg); + ASSERT_TRUE(reverseString); + + rtl::function reverse_string = reverseString->argsT().returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + EXPECT_EQ(ret_str, exp_str); + } { + std::optional reverseString = cxx::mirror().getFunction(str_revStrNonConstRefArg); + ASSERT_TRUE(reverseString); + + rtl::function reverse_string = reverseString->argsT().returnT(); + ASSERT_TRUE(reverse_string); + + auto lvstr = std::string_view(str); + std::string ret_str = reverse_string(lvstr); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref; + EXPECT_EQ(ret_str, exp_str); + } { + std::optional reverseString = cxx::mirror().getFunction(str_revStrRValueRefArg); + ASSERT_TRUE(reverseString); + + rtl::function reverse_string = reverseString->argsT().returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(std::string_view(str)); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_rvref; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_function, overloads_with_ref_and_value_args_call_with_known_signature) + { + std::optional reverseString = cxx::mirror().getFunction(str_revStrOverloadValRef); + ASSERT_TRUE(reverseString); + { + rtl::function reverse_string = reverseString->argsT().returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(std::string_view(STRA)); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::function reverse_string = reverseString->argsT().returnT(); + ASSERT_TRUE(reverse_string); + + std::string_view str = STRA; + std::string ret_str = reverse_string(str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_function, overloads_with_const_ref_and_value_args_call_with_known_signature) + { + std::optional reverseString = cxx::mirror().getFunction(str_revStrOverloadValCRef); + ASSERT_TRUE(reverseString); + { + rtl::function reverse_string = reverseString->argsT().returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(std::string_view(STRA)); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::function reverse_string = reverseString->argsT().returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(std::string_view(STRA)); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_function, overloads_with_ref_and_const_ref_args_call_with_known_signature) + { + std::optional reverseString = cxx::mirror().getFunction(str_revStrOverloadValRefAndCRef); + ASSERT_TRUE(reverseString); + { + rtl::function reverse_string = reverseString->argsT().returnT(); + ASSERT_TRUE(reverse_string); + + std::string_view str = STRA; + std::string ret_str = reverse_string(str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::function reverse_string = reverseString->argsT().returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(std::string_view(STRA)); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + EXPECT_EQ(ret_str, exp_str); + } + } +} \ No newline at end of file diff --git a/RTLTestRunApp/src/FunctionalityTests/StaticTypeReflectiveCalls/StrictStaticTypeDispatch_Method.cpp b/RTLTestRunApp/src/FunctionalityTests/StaticTypeReflectiveCalls/StrictStaticTypeDispatch_Method.cpp new file mode 100644 index 00000000..0d6d184c --- /dev/null +++ b/RTLTestRunApp/src/FunctionalityTests/StaticTypeReflectiveCalls/StrictStaticTypeDispatch_Method.cpp @@ -0,0 +1,336 @@ + +#include +#include + +#include + +#include "TestMirrorProvider.h" +#include "GlobalTestUtils.h" +#include "../CxxTestProps/inc/StringOps.h" + +using namespace test_utils; +using namespace test_mirror; + +namespace rtl_tests +{ + TEST(StrictStaticTypeRtl_method, overload_resolution_with_known_signatures) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); + ASSERT_TRUE(optStringUtil); + + std::optional reverseString = optStringUtil->getMethod(str_reverseString); + ASSERT_TRUE(reverseString); + { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + EXPECT_FALSE(reverse_string); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + EXPECT_FALSE(reverse_string); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + EXPECT_FALSE(reverse_string); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + EXPECT_FALSE(reverse_string); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(StrMute())(STRA); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_const_char_ptr; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(StrMute())(STRB); + auto exp_str = std::string(STRB_REVERSE) + SUFFIX_std_string; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT<>() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(StrMute())(); + auto exp_str = std::string(REV_STR_VOID_RET) + SUFFIX_void; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_method, lvalue_ref_overload_resolution_with_known_signatures) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); + ASSERT_TRUE(optStringUtil); + + //non-const target. + StrMute target; + std::optional reverseString = optStringUtil->getMethod(str_reverseString); + ASSERT_TRUE(reverseString); + { + //argument lvalue-ref + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + std::string lv_str = STRA; + std::string ret_str = reverse_string(target)(lv_str); + + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_lvref; + EXPECT_EQ(ret_str, exp_str); + } { + //argument const-lvalue-ref + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + const std::string lv_str = STRA; + std::string ret_str = reverse_string(target)(lv_str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_clvref; + EXPECT_EQ(ret_str, exp_str); + } { + //argument lvalue-ref + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + //const-target. + const StrMute& c_target = target; + std::string lv_str = STRA; + + // compile error - + // std::string ret_str = reverse_string(const_target)(lv_str); + std::string ret_str = reverse_string(const_cast(c_target))(lv_str); + + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_lvref; + EXPECT_EQ(ret_str, exp_str); + } { + //argument const-lvalue-ref + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + //const-target. + const StrMute& c_target = target; + std::string lv_str = STRA; + + // compile error - + // std::string ret_str = reverse_string(c_target)(lv_str); + std::string ret_str = reverse_string(const_cast(c_target))(lv_str); + + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_clvref; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_method, rvalue_ref_overload_resolution_with_known_signatures) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); + ASSERT_TRUE(optStringUtil); + + StrMute target; + std::optional reverseString = optStringUtil->getMethod(str_reverseString); + ASSERT_TRUE(reverseString); + { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(target)(STRA); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_rvref; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + EXPECT_FALSE(reverse_string); + } + } + + + TEST(StrictStaticTypeRtl_method, ptr_and_const_ptr_overload_resolution_with_known_signatures) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); + ASSERT_TRUE(optStringUtil); + + StrMute target; + std::string str = STRA; + std::optional reverseString = optStringUtil->getMethod(str_reverseString); + ASSERT_TRUE(reverseString); + { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(target)(&str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_ptr; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(target)(&str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_cptr; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_method, distinct_functions_with_ref_args_call_with_known_signature) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); + ASSERT_TRUE(optStringUtil); + + StrMute target; + std::string str = STRA; + { + std::optional reverseString = optStringUtil->getMethod(str_revStrConstRefArg); + ASSERT_TRUE(reverseString); + + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(target)(str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + EXPECT_EQ(ret_str, exp_str); + } { + std::optional reverseString = optStringUtil->getMethod(str_revStrNonConstRefArg); + ASSERT_TRUE(reverseString); + + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + auto lvstr = std::string_view(str); + std::string ret_str = reverse_string(target)(lvstr); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref; + EXPECT_EQ(ret_str, exp_str); + } { + std::optional reverseString = optStringUtil->getMethod(str_revStrRValueRefArg); + ASSERT_TRUE(reverseString); + + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(target)(std::string_view(str)); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_rvref; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_method, overloads_with_ref_and_value_args_call_with_known_signature) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); + ASSERT_TRUE(optStringUtil); + + StrMute target; + std::optional reverseString = optStringUtil->getMethod(str_revStrOverloadValRef); + ASSERT_TRUE(reverseString); + { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(target)(std::string_view(STRA)); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string_view str = STRA; + std::string ret_str = reverse_string(target)(str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_method, overloads_with_const_ref_and_value_args_call_with_known_signature) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); + ASSERT_TRUE(optStringUtil); + + StrMute target; + std::optional reverseString = optStringUtil->getMethod(str_revStrOverloadValCRef); + ASSERT_TRUE(reverseString); + { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(target)(std::string_view(STRA)); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(target)(std::string_view(STRA)); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_method, overloads_with_ref_and_const_ref_args_call_with_known_signature) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); + ASSERT_TRUE(optStringUtil); + + StrMute target; + std::optional reverseString = optStringUtil->getMethod(str_revStrOverloadValRefAndCRef); + ASSERT_TRUE(reverseString); + { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string_view str = STRA; + std::string ret_str = reverse_string(target)(str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::method reverse_string = reverseString->targetT() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(target)(std::string_view(STRA)); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + EXPECT_EQ(ret_str, exp_str); + } + } +} \ No newline at end of file diff --git a/RTLTestRunApp/src/FunctionalityTests/StaticTypeReflectiveCalls/StrictStaticTypeDispatch_StaticMethod.cpp b/RTLTestRunApp/src/FunctionalityTests/StaticTypeReflectiveCalls/StrictStaticTypeDispatch_StaticMethod.cpp new file mode 100644 index 00000000..3116b0f2 --- /dev/null +++ b/RTLTestRunApp/src/FunctionalityTests/StaticTypeReflectiveCalls/StrictStaticTypeDispatch_StaticMethod.cpp @@ -0,0 +1,371 @@ + +#include +#include + +#include "TestMirrorProvider.h" +#include "GlobalTestUtils.h" +#include "../CxxTestProps/inc/StringOps.h" + +using namespace test_utils; +using namespace test_mirror; + +namespace rtl_tests +{ + TEST(StrictStaticTypeRtl_static_method, using_wrong_class_n_callable_apis_for_static_method) + { + { + std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); // has only static-methods. + ASSERT_TRUE(optStringUtil); + + std::optional reverseString = optStringUtil->getMethod(str_reverseString); + ASSERT_TRUE(reverseString); + { + rtl::method reverse_string = reverseString.value() + .targetT() + .argsT() + .returnT(); + EXPECT_FALSE(reverse_string); + EXPECT_EQ(reverse_string.get_init_error(), rtl::error::InvalidStaticMethodCaller); + } { + rtl::function reverse_string = static_cast(reverseString.value()) + .argsT() + .returnT(); + EXPECT_FALSE(reverse_string); + EXPECT_EQ(reverse_string.get_init_error(), rtl::error::InvalidStaticMethodCaller); + } + } { + std::optional optStringUtil = cxx::mirror().getRecord(StrConst::struct_); // doesn't have any static-methods. + ASSERT_TRUE(optStringUtil); + + std::optional reverseString = optStringUtil->getMethod(str_reverseString); + ASSERT_TRUE(reverseString); + + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + EXPECT_FALSE(reverse_string); + EXPECT_EQ(reverse_string.get_init_error(), rtl::error::InvalidNonStaticMethodCaller); + } { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); // doesn't have any static-methods. + ASSERT_TRUE(optStringUtil); + + std::optional reverseString = optStringUtil->getMethod(str_reverseString); + ASSERT_TRUE(reverseString); + { + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + EXPECT_FALSE(reverse_string); + EXPECT_EQ(reverse_string.get_init_error(), rtl::error::InvalidNonStaticMethodCaller); + } + } + } + + + TEST(StrictStaticTypeRtl_static_method, overload_resolution_with_known_signatures) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); + ASSERT_TRUE(optStringUtil); + + std::optional reverseString = optStringUtil.value().getMethod(str_reverseString); + ASSERT_TRUE(reverseString); + { + rtl::method reverse_string = reverseString.value() + .targetT() + .argsT() + .returnT(); + EXPECT_FALSE(reverse_string); + } { + rtl::method reverse_string = reverseString.value() + .targetT() + .argsT() + .returnT(); + EXPECT_FALSE(reverse_string); + } { + rtl::method reverse_string = reverseString.value() + .targetT() + .argsT() + .returnT(); + EXPECT_FALSE(reverse_string); + } { + rtl::method reverse_string = reverseString.value() + .targetT() + .argsT() + .returnT(); + EXPECT_FALSE(reverse_string); + } { + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(STRA); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_const_char_ptr + SUFFIX_static; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(STRB); + auto exp_str = std::string(STRB_REVERSE) + SUFFIX_std_string + SUFFIX_static; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::static_method reverse_string = reverseString.value() + .argsT<>() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(); + auto exp_str = std::string(REV_STR_VOID_RET) + SUFFIX_void + SUFFIX_static; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_static_method, lvalue_ref_overload_resolution_with_known_signatures) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); + ASSERT_TRUE(optStringUtil); + + //non-const target. + StrMute target; + std::optional reverseString = optStringUtil->getMethod(str_reverseString); + ASSERT_TRUE(reverseString); + { + //argument lvalue-ref + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + std::string lv_str = STRA; + std::string ret_str = reverse_string(lv_str); + + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_lvref + SUFFIX_static; + EXPECT_EQ(ret_str, exp_str); + } { + //argument const-lvalue-ref + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + const std::string lv_str = STRA; + std::string ret_str = reverse_string(lv_str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_clvref + SUFFIX_static; + EXPECT_EQ(ret_str, exp_str); + } { + //argument lvalue-ref + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + std::string lv_str = STRA; + std::string ret_str = reverse_string(lv_str); + + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_lvref + SUFFIX_static; + EXPECT_EQ(ret_str, exp_str); + } { + //argument const-lvalue-ref + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + //const-target. + const StrMute& c_target = target; + std::string lv_str = STRA; + + std::string ret_str = reverse_string(lv_str); + + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_clvref + SUFFIX_static; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_static_method, rvalue_ref_overload_resolution_with_known_signatures) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); + ASSERT_TRUE(optStringUtil); + + std::optional reverseString = optStringUtil->getMethod(str_reverseString); + ASSERT_TRUE(reverseString); + { + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(STRA); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_rvref + SUFFIX_static; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_static_method, ptr_and_const_ptr_overload_resolution_with_known_signatures) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); + ASSERT_TRUE(optStringUtil); + + std::string str = STRA; + std::optional reverseString = optStringUtil->getMethod(str_reverseString); + ASSERT_TRUE(reverseString); + { + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(&str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_ptr + SUFFIX_static; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(&str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_cptr + SUFFIX_static; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_static_method, distinct_functions_with_ref_args_call_with_known_signature) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); + ASSERT_TRUE(optStringUtil); + + std::string str = STRA; + { + std::optional reverseString = optStringUtil->getMethod(str_revStrConstRefArg); + ASSERT_TRUE(reverseString); + + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref + SUFFIX_static; + EXPECT_EQ(ret_str, exp_str); + } { + std::optional reverseString = optStringUtil->getMethod(str_revStrNonConstRefArg); + ASSERT_TRUE(reverseString); + + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + auto lvstr = std::string_view(str); + std::string ret_str = reverse_string(lvstr); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref + SUFFIX_static; + EXPECT_EQ(ret_str, exp_str); + } { + std::optional reverseString = optStringUtil->getMethod(str_revStrRValueRefArg); + ASSERT_TRUE(reverseString); + + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(std::string_view(str)); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_rvref + SUFFIX_static; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_static_method, overloads_with_ref_and_value_args_call_with_known_signature) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); + ASSERT_TRUE(optStringUtil); + + std::optional reverseString = optStringUtil->getMethod(str_revStrOverloadValRef); + ASSERT_TRUE(reverseString); + { + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(std::string_view(STRA)); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view + SUFFIX_static; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string_view str = STRA; + std::string ret_str = reverse_string(str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref + SUFFIX_static; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_static_method, overloads_with_const_ref_and_value_args_call_with_known_signature) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); + ASSERT_TRUE(optStringUtil); + + std::optional reverseString = optStringUtil->getMethod(str_revStrOverloadValCRef); + ASSERT_TRUE(reverseString); + { + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(std::string_view(STRA)); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view + SUFFIX_static; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(std::string_view(STRA)); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref + SUFFIX_static; + EXPECT_EQ(ret_str, exp_str); + } + } + + + TEST(StrictStaticTypeRtl_static_method, overloads_with_ref_and_const_ref_args_call_with_known_signature) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); + ASSERT_TRUE(optStringUtil); + + std::optional reverseString = optStringUtil->getMethod(str_revStrOverloadValRefAndCRef); + ASSERT_TRUE(reverseString); + { + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string_view str = STRA; + std::string ret_str = reverse_string(str); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref + SUFFIX_static; + EXPECT_EQ(ret_str, exp_str); + } { + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT(); + ASSERT_TRUE(reverse_string); + + std::string ret_str = reverse_string(std::string_view(STRA)); + auto exp_str = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref + SUFFIX_static; + EXPECT_EQ(ret_str, exp_str); + } + } +} \ No newline at end of file diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedReflectiveCalls/BasicTypeErasedDispatch_ConstMethod.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedReflectiveCalls/BasicTypeErasedDispatch_ConstMethod.cpp new file mode 100644 index 00000000..e69de29b diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedReflectiveCalls/BasicTypeErasedDispatch_Function.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedReflectiveCalls/BasicTypeErasedDispatch_Function.cpp new file mode 100644 index 00000000..d32dda88 --- /dev/null +++ b/RTLTestRunApp/src/FunctionalityTests/TypeErasedReflectiveCalls/BasicTypeErasedDispatch_Function.cpp @@ -0,0 +1,553 @@ + +#include +#include +#include +#include + +#include "TestMirrorProvider.h" +#include "GlobalTestUtils.h" + +using namespace test_utils; +using namespace test_mirror; + +namespace rtl_tests +{ + TEST(ReturnTypeErased_rtl_function, invalid_erased_return_rtl_function) + { + { + rtl::function erased_ret_fn; + EXPECT_FALSE(erased_ret_fn); + + auto [err, robj] = erased_ret_fn(); + EXPECT_EQ(err, rtl::error::InvalidCaller); + EXPECT_TRUE(robj.isEmpty()); + } + + rtl::function erased_ret_fn; + EXPECT_FALSE(erased_ret_fn); + { + auto [err, robj] = erased_ret_fn(0); + EXPECT_EQ(err, rtl::error::InvalidCaller); + EXPECT_TRUE(robj.isEmpty()); + } { + auto [err, robj] = erased_ret_fn.bind()(0); + EXPECT_EQ(err, rtl::error::InvalidCaller); + EXPECT_TRUE(robj.isEmpty()); + } { + auto [err, robj] = erased_ret_fn.bind()(0); + EXPECT_EQ(err, rtl::error::InvalidCaller); + EXPECT_TRUE(robj.isEmpty()); + } + } + + + TEST(ReturnTypeErased_rtl_function, implicit_resolutions_to_call_by_value_overloads) + { + auto reverseStrOpt = cxx::mirror().getFunction(str_reverseString); + ASSERT_TRUE(reverseStrOpt); + EXPECT_FALSE(reverseStrOpt->hasSignature()); + { + rtl::function reverseString = reverseStrOpt->argsT().returnT<>(); + EXPECT_FALSE(reverseString); + { + auto [err, robj] = reverseString(const_cast(STRA)); + + EXPECT_EQ(err, rtl::error::InvalidCaller); + EXPECT_TRUE(robj.isEmpty()); + } { + auto [err, robj] = reverseString.bind()(const_cast(STRA)); + + EXPECT_EQ(err, rtl::error::InvalidCaller); + EXPECT_TRUE(robj.isEmpty()); + } + } + EXPECT_TRUE(reverseStrOpt->hasSignature()); + { + rtl::function reverseString = reverseStrOpt->argsT().returnT<>(); + EXPECT_TRUE(reverseString); + { + auto [err, robj] = reverseString(STRA); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_const_char_ptr; + EXPECT_EQ(retStr, expStr); + } { + auto [err, robj] = reverseString.bind()(STRA); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_const_char_ptr; + EXPECT_EQ(retStr, expStr); + } + } + EXPECT_TRUE(reverseStrOpt->hasSignature()); + { + rtl::function reverseString = reverseStrOpt->argsT().returnT<>(); + EXPECT_TRUE(reverseString); + { + auto [err, robj] = reverseString(STRA); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string; + EXPECT_EQ(retStr, expStr); + } { + auto [err, robj] = reverseString.bind()(STRA); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string; + EXPECT_EQ(retStr, expStr); + } + } + EXPECT_TRUE(reverseStrOpt->hasSignature()); + { + rtl::function reverseString = reverseStrOpt->argsT().returnT<>(); + EXPECT_TRUE(reverseString); + { + std::string str = STRA; + auto [err, robj] = reverseString(&str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_ptr; + EXPECT_EQ(retStr, expStr); + } { + std::string str = STRA; + auto [err, robj] = reverseString.bind()(&str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_ptr; + EXPECT_EQ(retStr, expStr); + } + } + EXPECT_TRUE(reverseStrOpt->hasSignature()); + { + rtl::function reverseString = reverseStrOpt->argsT().returnT<>(); + EXPECT_TRUE(reverseString); + { + const std::string str = STRA; + auto [err, robj] = reverseString(&str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_cptr; + EXPECT_EQ(retStr, expStr); + } { + const std::string str = STRA; + auto [err, robj] = reverseString.bind()(&str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_cptr; + EXPECT_EQ(retStr, expStr); + } + } + EXPECT_TRUE(reverseStrOpt->hasSignature<>()); + { + rtl::function reverseString = reverseStrOpt->argsT<>().returnT<>(); + EXPECT_TRUE(reverseString); + { + auto [err, robj] = reverseString(); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(REV_STR_VOID_RET) + SUFFIX_void; + EXPECT_EQ(retStr, expStr); + } { + auto [err, robj] = reverseString.bind()(); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(REV_STR_VOID_RET) + SUFFIX_void; + EXPECT_EQ(retStr, expStr); + } + } + } + + + TEST(ReturnTypeErased_rtl_function, implicit_resolution_to_ambiguous_lvalue_and_cref_overload) + { + auto revStrOverloadValCRefOpt = cxx::mirror().getFunction(str_revStrOverloadValCRef); + ASSERT_TRUE(revStrOverloadValCRefOpt); + + EXPECT_FALSE(revStrOverloadValCRefOpt->hasSignature()); + EXPECT_FALSE(revStrOverloadValCRefOpt->hasSignature()); + + // Both by-value (T) and const-ref (const T&) overloads exist. + EXPECT_TRUE(revStrOverloadValCRefOpt->hasSignature()); + EXPECT_TRUE(revStrOverloadValCRefOpt->hasSignature()); + std::string_view str = STRA; + + rtl::function reverseString = revStrOverloadValCRefOpt->argsT().returnT<>(); + EXPECT_TRUE(reverseString); + { + // RTL chooses the safe by-value overload implicitly. The const-ref + // path requires explicit binding only to disambiguate intent. + // Note: If only const T& existed (no by-value overload), RTL would + // call it implicitly, since binding to const-ref cannot mutate the caller. + auto [err, robj] = reverseString(str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view; + EXPECT_EQ(retStr, expStr); + } { + // explicit call by value resolution. + auto [err, robj] = reverseString.bind()(str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view; + EXPECT_EQ(retStr, expStr); + } + } + + + TEST(ReturnTypeErased_rtl_function, explicit_resolution_to_ambiguous_lvalue_and_cref_overload) + { + auto revStrOverloadValCRefOpt = cxx::mirror().getFunction(str_revStrOverloadValCRef); + ASSERT_TRUE(revStrOverloadValCRefOpt); + + EXPECT_FALSE(revStrOverloadValCRefOpt->hasSignature()); + EXPECT_FALSE(revStrOverloadValCRefOpt->hasSignature()); + + // Both by-value (T) and const-ref (const T&) overloads exist. + EXPECT_TRUE(revStrOverloadValCRefOpt->hasSignature()); + EXPECT_TRUE(revStrOverloadValCRefOpt->hasSignature()); + std::string_view str = STRA; + + rtl::function reverseString = revStrOverloadValCRefOpt->argsT().returnT<>(); + EXPECT_TRUE(reverseString); + { + // Explicitly selecting the const-ref overload using .bind(). + // If no by-value overload were present, implicit resolution to const-ref + // would have worked automatically, because const-ref cannot mutate. + auto [err, robj] = reverseString.bind()(str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + EXPECT_EQ(retStr, expStr); + } { + auto [err, robj] = reverseString.bind()(str); + + EXPECT_EQ(err, rtl::error::RefBindingMismatch); + ASSERT_TRUE(robj.isEmpty()); + } + } + + + TEST(ReturnTypeErased_rtl_function, implicit_resolution_to_ambiguous_lvalue_and_ref_overload) + { + auto revStrOverloadValRefOpt = cxx::mirror().getFunction(str_revStrOverloadValRef); + ASSERT_TRUE(revStrOverloadValRefOpt); + + EXPECT_FALSE(revStrOverloadValRefOpt->hasSignature()); + EXPECT_FALSE(revStrOverloadValRefOpt->hasSignature()); + + // Here both by-value (T) and non-const ref (T&) overloads exist. + EXPECT_TRUE(revStrOverloadValRefOpt->hasSignature()); + EXPECT_TRUE(revStrOverloadValRefOpt->hasSignature()); + std::string_view str = STRA; + + rtl::function reverseString = revStrOverloadValRefOpt->argsT().returnT<>(); + { + // Here also, RTL prioritizes the safe-by-value overload automatically + // since it guarantees no mutation. The non-const ref overload remains + // accessible only through explicit binding to preserve mutability intent. + auto [err, robj] = reverseString(str); + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view; + EXPECT_EQ(retStr, expStr); + } { + // explicit call by value resolution. + auto [err, robj] = reverseString.bind()(str); + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view; + EXPECT_EQ(retStr, expStr); + } + } + + + TEST(ReturnTypeErased_rtl_function, explicit_resolution_to_ambiguous_lvalue_and_ref_overload) + { + auto revStrOverloadValRefOpt = cxx::mirror().getFunction(str_revStrOverloadValRef); + ASSERT_TRUE(revStrOverloadValRefOpt); + + EXPECT_FALSE(revStrOverloadValRefOpt->hasSignature()); + EXPECT_FALSE(revStrOverloadValRefOpt->hasSignature()); + + // Here both by-value (T) and non-const ref (T&) overloads exist. + EXPECT_TRUE(revStrOverloadValRefOpt->hasSignature()); + EXPECT_TRUE(revStrOverloadValRefOpt->hasSignature()); + std::string_view str = STRA; + + rtl::function reverseString = revStrOverloadValRefOpt->argsT().returnT<>(); + { + // Explicitly selecting the non-const ref overload. + // Even though the by-value overload is preferred implicitly for safety, + // the user can override that choice by binding explicitly as T&, + // signaling the intent to allow mutation through reflection. + auto [err, robj] = reverseString.bind()(str); + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref; + EXPECT_EQ(retStr, expStr); + } { + auto [err, robj] = reverseString.bind()(str); + EXPECT_EQ(err, rtl::error::RefBindingMismatch); + ASSERT_TRUE(robj.isEmpty()); + } + } + + + TEST(ReturnTypeErased_rtl_function, calling_non_overloaded_non_const_ref_argument) + { + auto revStrNonConstRefArgOpt = cxx::mirror().getFunction(str_revStrNonConstRefArg); + ASSERT_TRUE(revStrNonConstRefArgOpt); + + EXPECT_FALSE(revStrNonConstRefArgOpt->hasSignature()); + EXPECT_FALSE(revStrNonConstRefArgOpt->hasSignature()); + EXPECT_FALSE(revStrNonConstRefArgOpt->hasSignature()); + + // Here no overloads exists, only non-const ref (T&) argument. + EXPECT_TRUE(revStrNonConstRefArgOpt->hasSignature()); + std::string_view str = STRA; + + rtl::function reverseString = revStrNonConstRefArgOpt->argsT().returnT<>(); + EXPECT_TRUE(reverseString); + + // Calls that may mutate user data (T&) require explicit intent. + // Hence, the dispatcher returns 'ExplicitRefBindingRequired' error. + // Since no call by value overload exists. + { + auto [err, robj] = reverseString(str); + EXPECT_EQ(err, rtl::error::ExplicitRefBindingRequired); + } { + // expected non-const ref binding. + auto [err, robj] = reverseString.bind()(str); + EXPECT_EQ(err, rtl::error::RefBindingMismatch); + } { + // By calling .bind(), the user explicitly signals willingness to let + // the function modify the argument. This re-enables the T& call path and + // executes successfully, producing the expected result. + auto [err, robj] = reverseString.bind()(str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref; + EXPECT_EQ(retStr, expStr); + } + } + + + TEST(ReturnTypeErased_rtl_function, calling_non_overloaded_const_ref_argument) + { + auto revStrConstRefArgOpt = cxx::mirror().getFunction(str_revStrConstRefArg); + ASSERT_TRUE(revStrConstRefArgOpt); + + EXPECT_FALSE(revStrConstRefArgOpt->hasSignature()); + EXPECT_FALSE(revStrConstRefArgOpt->hasSignature()); + EXPECT_FALSE(revStrConstRefArgOpt->hasSignature()); + + // Here no overloads exists, only non-const ref (T&) argument. + EXPECT_TRUE(revStrConstRefArgOpt->hasSignature()); + std::string_view str = STRA; + + rtl::function reverseString = revStrConstRefArgOpt->argsT().returnT<>(); + EXPECT_TRUE(reverseString); + { + // This call resolves to the const-ref overload (no other overloads exist), + // so the argument is implicitly bound as a const reference. + auto [err, robj] = reverseString(str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + EXPECT_EQ(retStr, expStr); + } { + // explicit binding must also behave the same way. + auto [err, robj] = reverseString.bind()(str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + EXPECT_EQ(retStr, expStr); + } { + // explicit binding to non-const ref returns error. + auto [err, robj] = reverseString.bind()(str); + + // expected 'const T&' + EXPECT_EQ(err, rtl::error::RefBindingMismatch); + ASSERT_TRUE(robj.isEmpty()); + } + } + + + TEST(ReturnTypeErased_rtl_function, calling_non_overloaded_rvalue_ref_argument) + { + auto revStrRValueRefArgOpt = cxx::mirror().getFunction(str_revStrRValueRefArg); + ASSERT_TRUE(revStrRValueRefArgOpt); + + EXPECT_FALSE(revStrRValueRefArgOpt->hasSignature()); + EXPECT_FALSE(revStrRValueRefArgOpt->hasSignature()); + EXPECT_FALSE(revStrRValueRefArgOpt->hasSignature()); + + // Here no overloads exists, only non-const ref (T&) argument. + EXPECT_TRUE(revStrRValueRefArgOpt->hasSignature()); + + rtl::function reverseString = revStrRValueRefArgOpt->argsT().returnT<>(); + EXPECT_TRUE(reverseString); + { + auto [err, robj] = reverseString(std::string_view(STRA)); + EXPECT_EQ(err, rtl::error::ExplicitRefBindingRequired); + } { + auto [err, robj] = reverseString.bind()(std::string_view(STRA)); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_rvref; + EXPECT_EQ(retStr, expStr); + } + } + + + TEST(ReturnTypeErased_rtl_function, implicit_resolution_to_ambiguous_ref_and_cref_overload) + { + auto revStrOverloadValRefNCrefOpt = cxx::mirror().getFunction(str_revStrOverloadValRefAndCRef); + ASSERT_TRUE(revStrOverloadValRefNCrefOpt); + + EXPECT_FALSE(revStrOverloadValRefNCrefOpt->hasSignature()); + EXPECT_FALSE(revStrOverloadValRefNCrefOpt->hasSignature()); + + // Here distinct overloads exists, with non-const ref (T&) and const-ref (const T&). + EXPECT_TRUE(revStrOverloadValRefNCrefOpt->hasSignature()); + EXPECT_TRUE(revStrOverloadValRefNCrefOpt->hasSignature()); + std::string_view str = STRA; + + rtl::function reverseString = revStrOverloadValRefNCrefOpt->argsT().returnT<>(); + EXPECT_TRUE(reverseString); + { + // Both T& and const T& overloads are viable for an lvalue argument. + // RTL avoids implicit ambiguity by requiring explicit ref binding + // when mutation is possible (non-const ref path). + auto [err, robj] = reverseString(str); + EXPECT_EQ(err, rtl::error::ExplicitRefBindingRequired); + } { + auto [err, robj] = reverseString.bind()(str); + EXPECT_EQ(err, rtl::error::RefBindingMismatch); + } { + auto [err, robj] = reverseString.bind()(str); + EXPECT_EQ(err, rtl::error::RefBindingMismatch); + } + } + + + TEST(ReturnTypeErased_rtl_function, explicit_resolution_to_ambiguous_ref_and_cref_overload) + { + auto revStrOverloadValRefNCrefOpt = cxx::mirror().getFunction(str_revStrOverloadValRefAndCRef); + ASSERT_TRUE(revStrOverloadValRefNCrefOpt); + + EXPECT_FALSE(revStrOverloadValRefNCrefOpt->hasSignature()); + EXPECT_FALSE(revStrOverloadValRefNCrefOpt->hasSignature()); + + // Here distinct overloads exists, with non-const ref (T&) and const-ref (const T&). + EXPECT_TRUE(revStrOverloadValRefNCrefOpt->hasSignature()); + EXPECT_TRUE(revStrOverloadValRefNCrefOpt->hasSignature()); + std::string_view str = STRA; + + rtl::function reverseString = revStrOverloadValRefNCrefOpt->argsT().returnT<>(); + EXPECT_TRUE(reverseString); + { + // Explicitly selecting the non-const ref overload. + // Caller signals intent to allow mutation by binding as T&. + auto [err, robj] = reverseString.bind()(str); + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref; + EXPECT_EQ(retStr, expStr); + } { + // Explicitly selecting the const ref overload. + // Note: If only 'const T&' existed, RTL would have resolved it implicitly. + // But since both 'T&' and 'const T&' overloads are available, + // RTL treats the situation as ambiguous and requires explicit selection + // to avoid guessing the user's intent regarding mutability. + auto [err, robj] = reverseString.bind()(str); + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + EXPECT_EQ(retStr, expStr); + } + } +} \ No newline at end of file diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedReflectiveCalls/BasicTypeErasedDispatch_Method.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedReflectiveCalls/BasicTypeErasedDispatch_Method.cpp new file mode 100644 index 00000000..a716229e --- /dev/null +++ b/RTLTestRunApp/src/FunctionalityTests/TypeErasedReflectiveCalls/BasicTypeErasedDispatch_Method.cpp @@ -0,0 +1,624 @@ + +#include +#include +#include +#include + +#include "TestMirrorProvider.h" +#include "GlobalTestUtils.h" +#include "../CxxTestProps/inc/StringOps.h" + +using namespace test_utils; +using namespace test_mirror; + +namespace rtl_tests +{ + TEST(ReturnTypeErased_rtl_method, invalid_erased_return_rtl_function) + { + { + rtl::method erased_ret_mt; + EXPECT_FALSE(erased_ret_mt); + + auto [err, robj] = erased_ret_mt(0)(); + EXPECT_EQ(err, rtl::error::InvalidCaller); + EXPECT_TRUE(robj.isEmpty()); + } + + rtl::method erased_ret_mt; + EXPECT_FALSE(erased_ret_mt); + { + auto [err, robj] = erased_ret_mt('a')(0); + EXPECT_EQ(err, rtl::error::InvalidCaller); + EXPECT_TRUE(robj.isEmpty()); + } { + auto [err, robj] = erased_ret_mt.bind('a')(0); + EXPECT_EQ(err, rtl::error::InvalidCaller); + EXPECT_TRUE(robj.isEmpty()); + } { + auto [err, robj] = erased_ret_mt.bind('a')(0); + EXPECT_EQ(err, rtl::error::InvalidCaller); + EXPECT_TRUE(robj.isEmpty()); + } + } + + + TEST(ReturnTypeErased_rtl_method, implicit_resolutions_to_call_by_value_overloads) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); + ASSERT_TRUE(optStringUtil); + + std::optional reverseStrOpt = optStringUtil->getMethod(str_reverseString); + ASSERT_TRUE(reverseStrOpt); + EXPECT_FALSE(reverseStrOpt->hasSignature()); + { + rtl::method reverseString = reverseStrOpt->targetT() + .argsT() + .returnT<>(); + EXPECT_FALSE(reverseString); + { + auto [err, robj] = reverseString(StrMute())(const_cast(STRA)); + + EXPECT_EQ(err, rtl::error::InvalidCaller); + EXPECT_TRUE(robj.isEmpty()); + } { + auto [err, robj] = reverseString.bind(StrMute())(const_cast(STRA)); + + EXPECT_EQ(err, rtl::error::InvalidCaller); + EXPECT_TRUE(robj.isEmpty()); + } + } + EXPECT_TRUE(reverseStrOpt->hasSignature()); + { + rtl::method reverseString = reverseStrOpt->targetT() + .argsT() + .returnT<>(); + EXPECT_TRUE(reverseString); + { + auto [err, robj] = reverseString(StrMute())(STRA); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_const_char_ptr; + EXPECT_EQ(retStr, expStr); + } { + auto [err, robj] = reverseString.bind(StrMute())(STRA); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_const_char_ptr; + EXPECT_EQ(retStr, expStr); + } + } + EXPECT_TRUE(reverseStrOpt->hasSignature()); + { + rtl::method reverseString = reverseStrOpt->targetT() + .argsT() + .returnT<>(); + EXPECT_TRUE(reverseString); + { + auto [err, robj] = reverseString(StrMute())(STRA); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string; + EXPECT_EQ(retStr, expStr); + } { + auto [err, robj] = reverseString.bind(StrMute())(STRA); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string; + EXPECT_EQ(retStr, expStr); + } + } + EXPECT_TRUE(reverseStrOpt->hasSignature()); + { + rtl::method reverseString = reverseStrOpt->targetT() + .argsT() + .returnT<>(); + EXPECT_TRUE(reverseString); + { + std::string str = STRA; + auto [err, robj] = reverseString(StrMute())(&str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_ptr; + EXPECT_EQ(retStr, expStr); + } { + std::string str = STRA; + auto [err, robj] = reverseString.bind(StrMute())(&str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_ptr; + EXPECT_EQ(retStr, expStr); + } + } + EXPECT_TRUE(reverseStrOpt->hasSignature()); + { + rtl::method reverseString = reverseStrOpt->targetT() + .argsT() + .returnT<>(); + EXPECT_TRUE(reverseString); + { + const std::string str = STRA; + auto [err, robj] = reverseString(StrMute())(&str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_cptr; + EXPECT_EQ(retStr, expStr); + } { + const std::string str = STRA; + auto [err, robj] = reverseString.bind(StrMute())(&str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_cptr; + EXPECT_EQ(retStr, expStr); + } + } + EXPECT_TRUE(reverseStrOpt->hasSignature<>()); + { + rtl::method reverseString = reverseStrOpt->targetT() + .argsT<>() + .returnT<>(); + EXPECT_TRUE(reverseString); + { + auto [err, robj] = reverseString(StrMute())(); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(REV_STR_VOID_RET) + SUFFIX_void; + EXPECT_EQ(retStr, expStr); + } { + auto [err, robj] = reverseString.bind(StrMute())(); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(REV_STR_VOID_RET) + SUFFIX_void; + EXPECT_EQ(retStr, expStr); + } + } + } + + + TEST(ReturnTypeErased_rtl_method, implicit_resolution_to_ambiguous_lvalue_and_cref_overload) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); + ASSERT_TRUE(optStringUtil); + + std::optional reverseStrOpt = optStringUtil->getMethod(str_revStrOverloadValCRef); + ASSERT_TRUE(reverseStrOpt); + + EXPECT_FALSE(reverseStrOpt->hasSignature()); + EXPECT_FALSE(reverseStrOpt->hasSignature()); + + // Both by-value (T) and const-ref (const T&) overloads exist. + EXPECT_TRUE(reverseStrOpt->hasSignature()); + EXPECT_TRUE(reverseStrOpt->hasSignature()); + + StrMute target; + std::string_view str = STRA; + rtl::method reverseString = reverseStrOpt->targetT() + .argsT() + .returnT<>(); + EXPECT_TRUE(reverseString); + { + // RTL chooses the safe by-value overload implicitly. The const-ref + // path requires explicit binding only to disambiguate intent. + // Note: If only const T& existed (no by-value overload), RTL would + // call it implicitly, since binding to const-ref cannot mutate the caller. + auto [err, robj] = reverseString(target)(str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view; + EXPECT_EQ(retStr, expStr); + } { + // explicit call by value resolution. + auto [err, robj] = reverseString.bind(target)(str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view; + EXPECT_EQ(retStr, expStr); + } + } + + + TEST(ReturnTypeErased_rtl_method, explicit_resolution_to_ambiguous_lvalue_and_cref_overload) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); + ASSERT_TRUE(optStringUtil); + + std::optional reverseStrOpt = optStringUtil->getMethod(str_revStrOverloadValCRef); + ASSERT_TRUE(reverseStrOpt); + + EXPECT_FALSE(reverseStrOpt->hasSignature()); + EXPECT_FALSE(reverseStrOpt->hasSignature()); + + // Both by-value (T) and const-ref (const T&) overloads exist. + EXPECT_TRUE(reverseStrOpt->hasSignature()); + EXPECT_TRUE(reverseStrOpt->hasSignature()); + + StrMute target; + std::string_view str = STRA; + rtl::method reverseString = reverseStrOpt->targetT() + .argsT() + .returnT<>(); + EXPECT_TRUE(reverseString); + { + // Explicitly selecting the const-ref overload using .bind(). + // If no by-value overload were present, implicit resolution to const-ref + // would have worked automatically, because const-ref cannot mutate. + auto [err, robj] = reverseString.bind(target)(str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + EXPECT_EQ(retStr, expStr); + } { + auto [err, robj] = reverseString.bind(target)(str); + + EXPECT_EQ(err, rtl::error::RefBindingMismatch); + ASSERT_TRUE(robj.isEmpty()); + } + } + + + TEST(ReturnTypeErased_rtl_method, implicit_resolution_to_ambiguous_lvalue_and_ref_overload) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); + ASSERT_TRUE(optStringUtil); + + std::optional reverseStrOpt = optStringUtil->getMethod(str_revStrOverloadValRef); + ASSERT_TRUE(reverseStrOpt); + + EXPECT_FALSE(reverseStrOpt->hasSignature()); + EXPECT_FALSE(reverseStrOpt->hasSignature()); + + // Here both by-value (T) and non-const ref (T&) overloads exist. + EXPECT_TRUE(reverseStrOpt->hasSignature()); + EXPECT_TRUE(reverseStrOpt->hasSignature()); + + StrMute target; + std::string_view str = STRA; + rtl::method reverseString = reverseStrOpt->targetT() + .argsT() + .returnT<>(); + EXPECT_TRUE(reverseString); + { + // Here also, RTL prioritizes the safe-by-value overload automatically + // since it guarantees no mutation. The non-const ref overload remains + // accessible only through explicit binding to preserve mutability intent. + auto [err, robj] = reverseString(target)(str); + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view; + EXPECT_EQ(retStr, expStr); + } { + // explicit call by value resolution. + auto [err, robj] = reverseString.bind(target)(str); + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view; + EXPECT_EQ(retStr, expStr); + } + } + + + TEST(ReturnTypeErased_rtl_method, explicit_resolution_to_ambiguous_lvalue_and_ref_overload) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); + ASSERT_TRUE(optStringUtil); + + std::optional reverseStrOpt = optStringUtil->getMethod(str_revStrOverloadValRef); + ASSERT_TRUE(reverseStrOpt); + + EXPECT_FALSE(reverseStrOpt->hasSignature()); + EXPECT_FALSE(reverseStrOpt->hasSignature()); + + // Here both by-value (T) and non-const ref (T&) overloads exist. + EXPECT_TRUE(reverseStrOpt->hasSignature()); + EXPECT_TRUE(reverseStrOpt->hasSignature()); + + StrMute target; + std::string_view str = STRA; + rtl::method reverseString = reverseStrOpt->targetT() + .argsT() + .returnT<>(); + EXPECT_TRUE(reverseString); + { + // Explicitly selecting the non-const ref overload. + // Even though the by-value overload is preferred implicitly for safety, + // the user can override that choice by binding explicitly as T&, + // signaling the intent to allow mutation through reflection. + auto [err, robj] = reverseString.bind(target)(str); + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref; + EXPECT_EQ(retStr, expStr); + } { + auto [err, robj] = reverseString.bind(target)(str); + EXPECT_EQ(err, rtl::error::RefBindingMismatch); + ASSERT_TRUE(robj.isEmpty()); + } + } + + + TEST(ReturnTypeErased_rtl_method, calling_non_overloaded_non_const_ref_argument) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); + ASSERT_TRUE(optStringUtil); + + std::optional reverseStrOpt = optStringUtil->getMethod(str_revStrNonConstRefArg); + ASSERT_TRUE(reverseStrOpt); + + EXPECT_FALSE(reverseStrOpt->hasSignature()); + EXPECT_FALSE(reverseStrOpt->hasSignature()); + EXPECT_FALSE(reverseStrOpt->hasSignature()); + + // Here no overloads exists, only non-const ref (T&) argument. + EXPECT_TRUE(reverseStrOpt->hasSignature()); + + StrMute target; + std::string_view str = STRA; + rtl::method reverseString = reverseStrOpt->targetT() + .argsT() + .returnT<>(); + EXPECT_TRUE(reverseString); + // Calls that may mutate user data (T&) require explicit intent. + // Hence, the dispatcher returns 'ExplicitRefBindingRequired' error. + // Since no call by value overload exists. + { + auto [err, robj] = reverseString(target)(str); + EXPECT_EQ(err, rtl::error::ExplicitRefBindingRequired); + } { + // expected non-const ref binding. + auto [err, robj] = reverseString.bind(target)(str); + EXPECT_EQ(err, rtl::error::RefBindingMismatch); + } { + // By calling .bind(), the user explicitly signals willingness to let + // the function modify the argument. This re-enables the T& call path and + // executes successfully, producing the expected result. + auto [err, robj] = reverseString.bind(target)(str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref; + EXPECT_EQ(retStr, expStr); + } + } + + + TEST(ReturnTypeErased_rtl_method, calling_non_overloaded_const_ref_argument) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); + ASSERT_TRUE(optStringUtil); + + std::optional reverseStrOpt = optStringUtil->getMethod(str_revStrConstRefArg); + ASSERT_TRUE(reverseStrOpt); + + EXPECT_FALSE(reverseStrOpt->hasSignature()); + EXPECT_FALSE(reverseStrOpt->hasSignature()); + EXPECT_FALSE(reverseStrOpt->hasSignature()); + + // Here no overloads exists, only non-const ref (T&) argument. + EXPECT_TRUE(reverseStrOpt->hasSignature()); + + StrMute target; + std::string_view str = STRA; + rtl::method reverseString = reverseStrOpt->targetT() + .argsT() + .returnT<>(); + EXPECT_TRUE(reverseString); + { + // This call resolves to the const-ref overload (no other overloads exist), + // so the argument is implicitly bound as a const reference. + auto [err, robj] = reverseString(target)(str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + EXPECT_EQ(retStr, expStr); + } { + // explicit binding must also behave the same way. + auto [err, robj] = reverseString.bind(target)(str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + EXPECT_EQ(retStr, expStr); + } { + // explicit binding to non-const ref returns error. + auto [err, robj] = reverseString.bind(target)(str); + + // expected 'const T&' + EXPECT_EQ(err, rtl::error::RefBindingMismatch); + ASSERT_TRUE(robj.isEmpty()); + } + } + + + TEST(ReturnTypeErased_rtl_method, calling_non_overloaded_rvalue_ref_argument) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); + ASSERT_TRUE(optStringUtil); + + std::optional reverseStrOpt = optStringUtil->getMethod(str_revStrRValueRefArg); + ASSERT_TRUE(reverseStrOpt); + + EXPECT_FALSE(reverseStrOpt->hasSignature()); + EXPECT_FALSE(reverseStrOpt->hasSignature()); + EXPECT_FALSE(reverseStrOpt->hasSignature()); + + // Here no overloads exists, only non-const ref (T&) argument. + EXPECT_TRUE(reverseStrOpt->hasSignature()); + + StrMute target; + rtl::method reverseString = reverseStrOpt->targetT() + .argsT() + .returnT<>(); + EXPECT_TRUE(reverseString); + { + auto [err, robj] = reverseString(target)(std::string_view(STRA)); + EXPECT_EQ(err, rtl::error::ExplicitRefBindingRequired); + } { + auto [err, robj] = reverseString.bind(target)(std::string_view(STRA)); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_rvref; + EXPECT_EQ(retStr, expStr); + } + } + + + TEST(ReturnTypeErased_rtl_method, implicit_resolution_to_ambiguous_ref_and_cref_overload) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); + ASSERT_TRUE(optStringUtil); + + std::optional reverseStrOpt = optStringUtil->getMethod(str_revStrOverloadValRefAndCRef); + ASSERT_TRUE(reverseStrOpt); + + EXPECT_FALSE(reverseStrOpt->hasSignature()); + EXPECT_FALSE(reverseStrOpt->hasSignature()); + + // Here distinct overloads exists, with non-const ref (T&) and const-ref (const T&). + EXPECT_TRUE(reverseStrOpt->hasSignature()); + EXPECT_TRUE(reverseStrOpt->hasSignature()); + + StrMute target; + std::string_view str = STRA; + rtl::method reverseString = reverseStrOpt->targetT() + .argsT() + .returnT<>(); + EXPECT_TRUE(reverseString); + { + // Both T& and const T& overloads are viable for an lvalue argument. + // RTL avoids implicit ambiguity by requiring explicit ref binding + // when mutation is possible (non-const ref path). + auto [err, robj] = reverseString(target)(str); + EXPECT_EQ(err, rtl::error::ExplicitRefBindingRequired); + } { + auto [err, robj] = reverseString.bind(target)(str); + EXPECT_EQ(err, rtl::error::RefBindingMismatch); + } { + auto [err, robj] = reverseString.bind(target)(str); + EXPECT_EQ(err, rtl::error::RefBindingMismatch); + } + } + + + TEST(ReturnTypeErased_rtl_method, explicit_resolution_to_ambiguous_ref_and_cref_overload) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); + ASSERT_TRUE(optStringUtil); + + std::optional reverseStrOpt = optStringUtil->getMethod(str_revStrOverloadValRefAndCRef); + ASSERT_TRUE(reverseStrOpt); + + EXPECT_FALSE(reverseStrOpt->hasSignature()); + EXPECT_FALSE(reverseStrOpt->hasSignature()); + + // Here distinct overloads exists, with non-const ref (T&) and const-ref (const T&). + EXPECT_TRUE(reverseStrOpt->hasSignature()); + EXPECT_TRUE(reverseStrOpt->hasSignature()); + + StrMute target; + std::string_view str = STRA; + rtl::method reverseString = reverseStrOpt->targetT() + .argsT() + .returnT<>(); + EXPECT_TRUE(reverseString); + { + // Explicitly selecting the non-const ref overload. + // Caller signals intent to allow mutation by binding as T&. + auto [err, robj] = reverseString.bind(target)(str); + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_lvref; + EXPECT_EQ(retStr, expStr); + } { + // Explicitly selecting the const ref overload. + // Note: If only 'const T&' existed, RTL would have resolved it implicitly. + // But since both 'T&' and 'const T&' overloads are available, + // RTL treats the situation as ambiguous and requires explicit selection + // to avoid guessing the user's intent regarding mutability. + auto [err, robj] = reverseString.bind(target)(str); + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_view_clvref; + EXPECT_EQ(retStr, expStr); + } + } +} \ No newline at end of file diff --git a/RTLTestRunApp/src/FunctionalityTests/TypeErasedReflectiveCalls/BasicTypeErasedDispatch_StaticMethod.cpp b/RTLTestRunApp/src/FunctionalityTests/TypeErasedReflectiveCalls/BasicTypeErasedDispatch_StaticMethod.cpp new file mode 100644 index 00000000..97259cd5 --- /dev/null +++ b/RTLTestRunApp/src/FunctionalityTests/TypeErasedReflectiveCalls/BasicTypeErasedDispatch_StaticMethod.cpp @@ -0,0 +1,252 @@ + +#include +#include +#include + +#include "TestMirrorProvider.h" +#include "GlobalTestUtils.h" +#include "../CxxTestProps/inc/StringOps.h" + +using namespace test_utils; +using namespace test_mirror; + +namespace rtl_tests +{ + TEST(ReturnTypeErased_rtl_static_method, using_wrong_class_n_callable_apis_for_static_method) + { + { + std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); // has only static-methods. + ASSERT_TRUE(optStringUtil); + + std::optional reverseString = optStringUtil->getMethod(str_reverseString); + ASSERT_TRUE(reverseString); + { + rtl::method reverse_string = reverseString.value() + .targetT() + .argsT() + .returnT<>(); + EXPECT_FALSE(reverse_string); + EXPECT_EQ(reverse_string.get_init_error(), rtl::error::InvalidStaticMethodCaller); + + auto [err, robj] = reverse_string(StrStatic())(std::string()); + EXPECT_EQ(err, rtl::error::InvalidStaticMethodCaller); + EXPECT_TRUE(robj.isEmpty()); + } { + rtl::function reverse_string = static_cast(reverseString.value()) + .argsT() + .returnT<>(); + EXPECT_FALSE(reverse_string); + EXPECT_EQ(reverse_string.get_init_error(), rtl::error::InvalidStaticMethodCaller); + + auto [err, robj] = reverse_string(std::string()); + EXPECT_EQ(err, rtl::error::InvalidStaticMethodCaller); + EXPECT_TRUE(robj.isEmpty()); + } + } { + std::optional optStringUtil = cxx::mirror().getRecord(StrConst::struct_); // doesn't have any static-methods. + ASSERT_TRUE(optStringUtil); + + std::optional reverseString = optStringUtil->getMethod(str_reverseString); + ASSERT_TRUE(reverseString); + + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT<>(); + EXPECT_FALSE(reverse_string); + EXPECT_EQ(reverse_string.get_init_error(), rtl::error::InvalidNonStaticMethodCaller); + + auto [err, robj] = reverse_string(std::string()); + EXPECT_EQ(err, rtl::error::InvalidNonStaticMethodCaller); + EXPECT_TRUE(robj.isEmpty()); + } { + std::optional optStringUtil = cxx::mirror().getRecord(StrMute::struct_); // doesn't have any static-methods. + ASSERT_TRUE(optStringUtil); + + std::optional reverseString = optStringUtil->getMethod(str_reverseString); + ASSERT_TRUE(reverseString); + { + rtl::static_method reverse_string = reverseString.value() + .argsT() + .returnT<>(); + EXPECT_FALSE(reverse_string); + EXPECT_EQ(reverse_string.get_init_error(), rtl::error::InvalidNonStaticMethodCaller); + + auto [err, robj] = reverse_string(std::string()); + EXPECT_EQ(err, rtl::error::InvalidNonStaticMethodCaller); + EXPECT_TRUE(robj.isEmpty()); + } + } + } + + + TEST(ReturnTypeErased_rtl_static_method, implicit_resolutions_to_call_by_value_overloads) + { + std::optional optStringUtil = cxx::mirror().getRecord(StrStatic::struct_); + ASSERT_TRUE(optStringUtil); + + std::optional reverseStrOpt = optStringUtil->getMethod(str_reverseString); + ASSERT_TRUE(reverseStrOpt); + EXPECT_FALSE(reverseStrOpt->hasSignature()); + { + rtl::method reverseString = reverseStrOpt.value() + .targetT() + .argsT() + .returnT<>(); + EXPECT_FALSE(reverseString); + { + auto [err, robj] = reverseString(StrStatic())(const_cast(STRA)); + + EXPECT_EQ(err, rtl::error::InvalidCaller); + EXPECT_TRUE(robj.isEmpty()); + } { + auto [err, robj] = reverseString.bind(StrStatic())(const_cast(STRA)); + + EXPECT_EQ(err, rtl::error::InvalidCaller); + EXPECT_TRUE(robj.isEmpty()); + } + } + EXPECT_TRUE(reverseStrOpt->hasSignature()); + { + rtl::method reverseString = reverseStrOpt.value() + .targetT() + .argsT() + .returnT<>(); + EXPECT_FALSE(reverseString); + { + auto [err, robj] = reverseString(StrStatic())(STRA); + EXPECT_EQ(err, rtl::error::InvalidStaticMethodCaller); + } + } { + rtl::static_method reverseString = reverseStrOpt.value() + .argsT() + .returnT<>(); + EXPECT_TRUE(reverseString); + { + auto [err, robj] = reverseString(STRA); + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_const_char_ptr + SUFFIX_static; + EXPECT_EQ(retStr, expStr); + } + } + EXPECT_TRUE(reverseStrOpt->hasSignature()); + { + rtl::static_method reverseString = reverseStrOpt.value() + .argsT() + .returnT<>(); + EXPECT_TRUE(reverseString); + { + auto [err, robj] = reverseString(STRA); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string + SUFFIX_static; + EXPECT_EQ(retStr, expStr); + } { + auto [err, robj] = reverseString.bind()(STRA); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string + SUFFIX_static; + EXPECT_EQ(retStr, expStr); + } + } + EXPECT_TRUE(reverseStrOpt->hasSignature()); + { + rtl::static_method reverseString = reverseStrOpt.value() + .argsT() + .returnT<>(); + EXPECT_TRUE(reverseString); + { + std::string str = STRA; + auto [err, robj] = reverseString(&str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_ptr + SUFFIX_static; + EXPECT_EQ(retStr, expStr); + } { + std::string str = STRA; + auto [err, robj] = reverseString.bind()(&str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_ptr + SUFFIX_static; + EXPECT_EQ(retStr, expStr); + } + } + EXPECT_TRUE(reverseStrOpt->hasSignature()); + { + rtl::static_method reverseString = reverseStrOpt.value() + .argsT() + .returnT<>(); + EXPECT_TRUE(reverseString); + { + const std::string str = STRA; + auto [err, robj] = reverseString(&str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_cptr + SUFFIX_static; + EXPECT_EQ(retStr, expStr); + } { + const std::string str = STRA; + auto [err, robj] = reverseString.bind()(&str); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(STRA_REVERSE) + SUFFIX_std_string_cptr + SUFFIX_static; + EXPECT_EQ(retStr, expStr); + } + } + EXPECT_TRUE(reverseStrOpt->hasSignature<>()); + { + rtl::static_method reverseString = reverseStrOpt.value() + .argsT<>() + .returnT<>(); + EXPECT_TRUE(reverseString); + { + auto [err, robj] = reverseString(); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(REV_STR_VOID_RET) + SUFFIX_void + SUFFIX_static; + EXPECT_EQ(retStr, expStr); + } { + auto [err, robj] = reverseString.bind()(); + + EXPECT_EQ(err, rtl::error::None); + ASSERT_FALSE(robj.isEmpty()); + ASSERT_TRUE(robj.canViewAs()); + + const std::string& retStr = robj.view()->get(); + std::string expStr = std::string(REV_STR_VOID_RET) + SUFFIX_void + SUFFIX_static; + EXPECT_EQ(retStr, expStr); + } + } + } +} \ No newline at end of file diff --git a/RTLTestRunApp/src/MyReflectionTests/MyCxxMirrorProvider.cpp b/RTLTestRunApp/src/MyReflectionTests/MyCxxMirrorProvider.cpp index d406e941..b68cd685 100644 --- a/RTLTestRunApp/src/MyReflectionTests/MyCxxMirrorProvider.cpp +++ b/RTLTestRunApp/src/MyReflectionTests/MyCxxMirrorProvider.cpp @@ -1,5 +1,6 @@ -#include "RTLibInterface.h" +#include + #include "MyReflectingType.h" namespace my_type @@ -49,7 +50,9 @@ namespace my_type /* Register a class/struct type without a namespace. Since no namespace is provided, it will be queried directly by name, e.g.: cxx_mirror().getRecord("Person"); - + + (class/struct- generally termed as 'Record' as per LLVM's naming convention) + This registration implicitly adds the default constructor, copy constructor, and destructor. Explicitly registering these members is not allowed and will result in a compile-time error. diff --git a/RTLTestRunApp/src/MyReflectionTests/MyReflectionTests.cpp b/RTLTestRunApp/src/MyReflectionTests/MyReflectionTests.cpp index 349c1836..33b7738e 100644 --- a/RTLTestRunApp/src/MyReflectionTests/MyReflectionTests.cpp +++ b/RTLTestRunApp/src/MyReflectionTests/MyReflectionTests.cpp @@ -1,7 +1,7 @@ #include +#include -#include "RTLibInterface.h" #include "MyReflectingType.h" using namespace my_type; @@ -176,28 +176,6 @@ namespace std::optional> strView = ret.view(); ASSERT_TRUE(strView); - const std::string& retStr = strView->get(); - // Confirms the expected static function was invoked. - EXPECT_EQ(retStr, expectReturnStr); - } { - // Now create a `Person` object and reflect it into RTL. - rtl::RObject robj = rtl::reflect(Person("")); - - // Even if we bind a target object before calling the static function, - // it has no effect — the call remains valid and succeeds. - // This matches C++ native semantics: binding an instance is irrelevant - // for static member functions. - auto [err, ret] = getDefaults->bind(robj).call(); - - // Validate reflective call succeeded. - EXPECT_TRUE(err == rtl::error::None); - EXPECT_FALSE(ret.isEmpty()); - - // Verify return type and extract result. - EXPECT_TRUE(ret.canViewAs()); - std::optional> strView = ret.view(); - ASSERT_TRUE(strView); - const std::string& retStr = strView->get(); // Confirms the expected static function was invoked. EXPECT_EQ(retStr, expectReturnStr); diff --git a/RTLTestRunApp/src/RObjectTests/RObjectReflecting_arrays.cpp b/RTLTestRunApp/src/RObjectTests/RObjectReflecting_arrays.cpp index 1a1753c6..692c85ba 100644 --- a/RTLTestRunApp/src/RObjectTests/RObjectReflecting_arrays.cpp +++ b/RTLTestRunApp/src/RObjectTests/RObjectReflecting_arrays.cpp @@ -14,8 +14,7 @@ */ #include - -#include "RTLibInterface.h" +#include using namespace rtl; diff --git a/RTLTestRunApp/src/RObjectTests/RObjectReflecting_bool.cpp b/RTLTestRunApp/src/RObjectTests/RObjectReflecting_bool.cpp index 914b0dc7..71396728 100644 --- a/RTLTestRunApp/src/RObjectTests/RObjectReflecting_bool.cpp +++ b/RTLTestRunApp/src/RObjectTests/RObjectReflecting_bool.cpp @@ -1,7 +1,6 @@  #include - -#include "RTLibInterface.h" +#include using namespace rtl; diff --git a/RTLTestRunApp/src/RObjectTests/RObjectReflecting_char.cpp b/RTLTestRunApp/src/RObjectTests/RObjectReflecting_char.cpp index 5acfa96e..d8d5da7a 100644 --- a/RTLTestRunApp/src/RObjectTests/RObjectReflecting_char.cpp +++ b/RTLTestRunApp/src/RObjectTests/RObjectReflecting_char.cpp @@ -1,7 +1,6 @@  #include - -#include "RTLibInterface.h" +#include using namespace rtl; diff --git a/RTLTestRunApp/src/RObjectTests/RObjectReflecting_int.cpp b/RTLTestRunApp/src/RObjectTests/RObjectReflecting_int.cpp index 57b8cd6c..6abb91e8 100644 --- a/RTLTestRunApp/src/RObjectTests/RObjectReflecting_int.cpp +++ b/RTLTestRunApp/src/RObjectTests/RObjectReflecting_int.cpp @@ -1,7 +1,6 @@  #include - -#include "RTLibInterface.h" +#include using namespace rtl; diff --git a/RTLTestRunApp/src/RObjectTests/RObjectReflecting_stdSharedPtr.cpp b/RTLTestRunApp/src/RObjectTests/RObjectReflecting_stdSharedPtr.cpp index 30d463fa..6a483e8d 100644 --- a/RTLTestRunApp/src/RObjectTests/RObjectReflecting_stdSharedPtr.cpp +++ b/RTLTestRunApp/src/RObjectTests/RObjectReflecting_stdSharedPtr.cpp @@ -1,9 +1,9 @@ #include #include +#include #include "Node.h" -#include "RTLibInterface.h" using namespace test_utils; using namespace rtl; @@ -152,6 +152,7 @@ namespace rtl::unit_test // Copies the underlying value, *not* the wrapper. auto [err, robj0] = robj.clone(); EXPECT_TRUE(err == error::None); + ASSERT_FALSE(robj0.isEmpty()); // Cannot view as shared_ptr, because we cloned the contained value. EXPECT_FALSE(robj0.canViewAs>()); @@ -230,6 +231,7 @@ namespace rtl::unit_test // Copies the underlying value, *not* the wrapper. auto [err, robj0] = robj.clone(); EXPECT_TRUE(err == error::None); + ASSERT_FALSE(robj0.isEmpty()); // Cannot view as shared_ptr, because we cloned the contained value. EXPECT_FALSE(robj0.canViewAs>()); diff --git a/RTLTestRunApp/src/RObjectTests/RObjectReflecting_stdUniquePtr.cpp b/RTLTestRunApp/src/RObjectTests/RObjectReflecting_stdUniquePtr.cpp index 5ff37e92..a43a8cd9 100644 --- a/RTLTestRunApp/src/RObjectTests/RObjectReflecting_stdUniquePtr.cpp +++ b/RTLTestRunApp/src/RObjectTests/RObjectReflecting_stdUniquePtr.cpp @@ -1,9 +1,9 @@ #include #include +#include #include "Node.h" -#include "RTLibInterface.h" using namespace test_utils; using namespace rtl; diff --git a/RTLTestRunApp/src/RObjectTests/RObjectReflecting_strings.cpp b/RTLTestRunApp/src/RObjectTests/RObjectReflecting_strings.cpp index 21d27632..c3ff3713 100644 --- a/RTLTestRunApp/src/RObjectTests/RObjectReflecting_strings.cpp +++ b/RTLTestRunApp/src/RObjectTests/RObjectReflecting_strings.cpp @@ -1,7 +1,6 @@ #include - -#include "RTLibInterface.h" +#include using namespace rtl; diff --git a/ReflectionTemplateLib/CMakeLists.txt b/ReflectionTemplateLib/CMakeLists.txt index 894d02b8..ce4f2db7 100644 --- a/ReflectionTemplateLib/CMakeLists.txt +++ b/ReflectionTemplateLib/CMakeLists.txt @@ -1,8 +1,5 @@ -# CMakeLists.txt for ReflectionTemplateLib - cmake_minimum_required(VERSION 3.20) -# Project definition project(ReflectionTemplateLib LANGUAGES CXX) # Require C++20 @@ -10,19 +7,21 @@ set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -# Library target +# Library target (static or shared) add_library(${PROJECT_NAME} STATIC) -# Public include directories +# Public include paths for this library target_include_directories(${PROJECT_NAME} PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/common - ${CMAKE_CURRENT_SOURCE_DIR}/detail/inc - ${CMAKE_CURRENT_SOURCE_DIR}/access/inc - ${CMAKE_CURRENT_SOURCE_DIR}/builder/inc + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/rtl/builder + ${CMAKE_CURRENT_SOURCE_DIR}/rtl/cache + ${CMAKE_CURRENT_SOURCE_DIR}/rtl/detail + ${CMAKE_CURRENT_SOURCE_DIR}/rtl/dispatch + ${CMAKE_CURRENT_SOURCE_DIR}/rtl/erasure + ${CMAKE_CURRENT_SOURCE_DIR}/rtl/inc + ${CMAKE_CURRENT_SOURCE_DIR}/rtl ) -# Add subdirectories for sources -add_subdirectory(detail/src) -add_subdirectory(access/src) -add_subdirectory(builder) \ No newline at end of file +# Add subdirectories +add_subdirectory(rtl) \ No newline at end of file diff --git a/ReflectionTemplateLib/access/inc/Function.hpp b/ReflectionTemplateLib/access/inc/Function.hpp deleted file mode 100644 index 4c620c71..00000000 --- a/ReflectionTemplateLib/access/inc/Function.hpp +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************* - * * - * Reflection Template Library (RTL) - Modern C++ Reflection Framework * - * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * - * * - * Copyright (c) 2025 Neeraj Singh * - * SPDX-License-Identifier: MIT * - * * - *************************************************************************/ - - -#pragma once - -#include "Function.h" -#include "FunctionCaller.hpp" - -namespace rtl -{ - template - inline const detail::FunctionCaller<_signature...> Function::bind() const noexcept - { - return detail::FunctionCaller<_signature...>{ this }; - } - -/* @method: hasSignature<...>() - @param: set of arguments, explicitly specified as template parameter. - @return: bool, if the functor associated with this object is of certain signature or not. - * a single 'Function' object can be associated with multiple overloads of same function. - * the set of arguments passed is checked agains all registered overloads, returns true if matched with any one. -*/ template - inline bool Function::hasSignature() const - { - //hasSignatureId() returns the index of the 'lambda' in functor-container, which cannot be '-1'. - return (hasSignatureId(detail::FunctorContainer<_args...>::getContainerId()) != -1); - } - - -/* @method: operator()() - @param: variadic arguments. - @return: Return, possible error & return value of from the reflected call. - * if the arguments did not match with any overload, returns RObject with error::SignatureMismatch - * providing optional syntax, Function::call() does the exact same thing. -*/ template - inline Return Function::operator()(_args&& ...params) const noexcept - { - return detail::FunctionCaller<>{ this }.call(std::forward<_args>(params)...); - } - - -/* @method: hasSignatureId() - @param: const std::size_t& (signatureId to be found) - @return: the index of the functor in the functor-table. - * a 'Function' object may be associated with multiple functors in case of overloads. - * every overload will have unique 'FunctorId', contained by one 'Function' object. - * given signatureId is compared against the signatureId of all overloads registered. -*/ FORCE_INLINE const std::size_t Function::hasSignatureId(const std::size_t pSignatureId) const - { - //simple linear-search, efficient for small set of elements. - for (const auto& functorId : m_functorIds) { - if (functorId.getSignatureId() == pSignatureId) [[likely]] { - return functorId.getIndex(); - } - } - return rtl::index_none; - } -} diff --git a/ReflectionTemplateLib/access/src/CMakeLists.txt b/ReflectionTemplateLib/access/src/CMakeLists.txt deleted file mode 100644 index 2615a2f3..00000000 --- a/ReflectionTemplateLib/access/src/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -# Create a variable containing the source files for your target -set(LOCAL_SOURCES - "${CMAKE_CURRENT_LIST_DIR}/CxxMirror.cpp" - "${CMAKE_CURRENT_LIST_DIR}/CxxMirrorToJson.cpp" - "${CMAKE_CURRENT_LIST_DIR}/Function.cpp" -) - -SET(COMMON_HEADERS - - "${PROJECT_SOURCE_DIR}/common/view.h" - "${PROJECT_SOURCE_DIR}/common/view.hpp" - "${PROJECT_SOURCE_DIR}/common/Constants.h" - "${PROJECT_SOURCE_DIR}/common/rtl_traits.h" - "${PROJECT_SOURCE_DIR}/common/error_codes.h" - "${PROJECT_SOURCE_DIR}/common/ConversionUtils.h" - "${PROJECT_SOURCE_DIR}/common/RTLibInterface.h" -) - -SET(LOCAL_HEADERS - "${PROJECT_SOURCE_DIR}/access/inc/CxxMirror.h" - "${PROJECT_SOURCE_DIR}/access/inc/CxxMirror.hpp" - "${PROJECT_SOURCE_DIR}/access/inc/CxxMirrorToJson.h" - "${PROJECT_SOURCE_DIR}/access/inc/Function.h" - "${PROJECT_SOURCE_DIR}/access/inc/Function.hpp" - "${PROJECT_SOURCE_DIR}/access/inc/Method.h" - "${PROJECT_SOURCE_DIR}/access/inc/Method.hpp" - "${PROJECT_SOURCE_DIR}/access/inc/Record.h" - "${PROJECT_SOURCE_DIR}/access/inc/RObject.h" - "${PROJECT_SOURCE_DIR}/access/inc/RObject.hpp" -) - -# Add any additional source files if needed -target_sources(ReflectionTemplateLib - PRIVATE - "${LOCAL_HEADERS}" - "${COMMON_HEADERS}" - "${LOCAL_SOURCES}" -) - - -SOURCE_GROUP("Source Files\\Access" FILES ${LOCAL_SOURCES}) -SOURCE_GROUP("Header Files\\Access" FILES ${LOCAL_HEADERS}) \ No newline at end of file diff --git a/ReflectionTemplateLib/builder/CMakeLists.txt b/ReflectionTemplateLib/builder/CMakeLists.txt deleted file mode 100644 index 0484adc6..00000000 --- a/ReflectionTemplateLib/builder/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# Create a variable containing the source files for your target - -SET(COMMON_HEADERS - "${PROJECT_SOURCE_DIR}/common/Constants.h" -) - -SET(LOCAL_HEADERS - "${CMAKE_CURRENT_LIST_DIR}/inc/ConstructorBuilder.h" - "${CMAKE_CURRENT_LIST_DIR}/inc/Builder.h" - "${CMAKE_CURRENT_LIST_DIR}/inc/Builder.hpp" - "${CMAKE_CURRENT_LIST_DIR}/inc/RecordBuilder.h" - "${CMAKE_CURRENT_LIST_DIR}/inc/RecordBuilder.hpp" - "${CMAKE_CURRENT_LIST_DIR}/inc/Reflect.h" - "${CMAKE_CURRENT_LIST_DIR}/inc/Reflect.hpp" -) - -# Add any additional source files if needed -target_sources(ReflectionTemplateLib - PRIVATE - "${LOCAL_HEADERS}" - "${COMMON_HEADERS}" -) - -SOURCE_GROUP("Header Files\\Builder" FILES ${LOCAL_HEADERS}) \ No newline at end of file diff --git a/ReflectionTemplateLib/builder/inc/Builder.h b/ReflectionTemplateLib/builder/inc/Builder.h deleted file mode 100644 index 687de0f2..00000000 --- a/ReflectionTemplateLib/builder/inc/Builder.h +++ /dev/null @@ -1,194 +0,0 @@ -/************************************************************************* - * * - * Reflection Template Library (RTL) - Modern C++ Reflection Framework * - * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * - * * - * Copyright (c) 2025 Neeraj Singh * - * SPDX-License-Identifier: MIT * - * * - *************************************************************************/ - - -#pragma once - -#include "Function.h" -#include "ReflectionBuilder.h" - -namespace rtl { - - namespace builder - { - struct CtorBuilder : protected detail::ReflectionBuilder - { - CtorBuilder(const std::string_view pNamespace, const std::string_view pRecord, - const std::string_view pFunction, std::size_t pRecordId); - - template - const Function build() const; - }; - - - /* @struct: Builder - @param: specialized with methodQ, - * methodQ::NonConst - provides interface to register member funtion. - * methodQ::Const - provides interface to register const-member funtions. - * methodQ::None - provides interface to register non-member and static member funtions. - @param: - * _signature: arguments types of functions pointers or constructors (auto deduced/explicitly specified). - * provides interface to register all sort of functions, methods & constructors. - * every specialization has a 'build()' function, which accepts a function pointer. - * function pointer can be non-member or member(static/const/non-const) functions. - */ template - struct Builder; - } - - - namespace builder - { - /* @struct: Builder - * specialized specifically to register overloaded non-member & static member functions with no arguments. - * Objects of this class will be created & returned by these functions, - * - type::function(..) - * - RecordBuilder<_recordType>::methodStatic(..) - * with template parameter is only 'void', explicitly specified. - */ template<> - struct Builder : protected detail::ReflectionBuilder - { - Builder(std::size_t pRecordId, const std::string_view pFunction, - const std::string_view pNamespace); - - template - const Function build(_returnType(*pFunctor)()) const; - }; - - - /* @struct: Builder - * specialized specifically to register overloaded non-member & static member functions with any arguments. - * Objects of this class will be created & returned by these functions, - * - type::function<...>(..) - * - RecordBuilder<_recordType>::methodStatic<...>(..) - * with template parameters can be anything, explicitly specified. - */ template - struct Builder : protected detail::ReflectionBuilder - { - Builder(std::size_t pRecordId, const std::string_view pFunction, - const std::string_view pNamespace); - - template - const Function build(_returnType(*pFunctor)(_signature...)) const; - }; - - - /* @struct: Builder - * specialized specifically to register non-member functions with any signature and with no overloads. - * Objects of this class will be created & returned by these functions, - * - type::function(..) - * - RecordBuilder<_recordType>::methodStatic(..) - * with no template parameters specified. - */ template<> - struct Builder : protected detail::ReflectionBuilder - { - Builder(std::size_t pRecordId, const std::string_view pFunction, - const std::string_view pNamespace); - - template - const Function build(_returnType(*pFunctor)(_signature...)) const; - }; - } - - - namespace builder - { - /* @struct: Builder - * specialized specifically to register overloaded const-member-functions with no arguments. - * Objects of this class will be created & returned by function, - * - RecordBuilder<_recordType>::methodConst(..) - * with template parameters is only 'void' explicitly specified. - */ template<> - struct Builder : protected detail::ReflectionBuilder - { - Builder(const std::string_view pFunction, std::size_t pRecordId); - - template - const Function build(_returnType(_recordType::* pFunctor)() const) const; - }; - - - /* @struct: Builder - * specialized specifically to register overloaded const-member-functions with any arguments. - * Objects of this class will be created & returned by function, - * - RecordBuilder<_recordType>::methodConst<...>(..) - * with template parameters can be anything, explicitly specified. - */ template - struct Builder : protected detail::ReflectionBuilder - { - Builder(const std::string_view pFunction, std::size_t pRecordId); - - template - const Function build(_returnType(_recordType::* pFunctor)(_signature...) const) const; - }; - - - /* @struct: Builder - * specialized specifically to register non-overloaded const-member-functions with any arguments. - * Objects of this class will be created & returned by function, - * - RecordBuilder<_recordType>::methodConst() - * with no template parameters specified. - */ template<> - struct Builder : protected detail::ReflectionBuilder - { - Builder(const std::string_view pFunction, std::size_t pRecordId); - - template - const Function build(_returnType(_recordType::* pFunctor)(_signature...) const) const; - }; - } - - - namespace builder - { - /* @struct: Builder - * specialized specifically to register overloaded non-const-member-functions with no arguments. - * Objects of this class will be created & returned by function, - * - RecordBuilder<_recordType>::method(..) - * with template parameters is only 'void' explicitly specified. - */ template<> - struct Builder : protected detail::ReflectionBuilder - { - Builder(const std::string_view pFunction, std::size_t pRecordId); - - template - const Function build(_returnType(_recordType::* pFunctor)()) const; - }; - - - /* @struct: Builder - * specialized specifically to register overloaded non-const-member-functions with no arguments. - * Objects of this class will be created & returned by function, - * - RecordBuilder<_recordType>::method(..) - * with template parameters is only 'void' explicitly specified. - */ template - struct Builder : protected detail::ReflectionBuilder - { - Builder(const std::string_view pFunction, std::size_t pRecordId); - - template - const Function build(_returnType(_recordType::* pFunctor)(_signature...)) const; - }; - - - /* @struct: Builder - * specialized specifically to register non-overloaded non-const-member-functions and constructors with any arguments. - * Objects of this class will be created & returned by function, - * - RecordBuilder<_recordType>::method() - with no template parameters specified. - * - RecordBuilder<_recordType>::constructor<...>() - template parameters can be anything or none, explicitly specified. - */ template<> - struct Builder : protected detail::ReflectionBuilder - { - Builder(const std::string_view pFunction, std::size_t pRecordId); - - template - const Function build(_returnType(_recordType::* pFunctor)(_signature...)) const; - }; - } -} \ No newline at end of file diff --git a/ReflectionTemplateLib/builder/inc/Builder.hpp b/ReflectionTemplateLib/builder/inc/Builder.hpp deleted file mode 100644 index ee74df9c..00000000 --- a/ReflectionTemplateLib/builder/inc/Builder.hpp +++ /dev/null @@ -1,232 +0,0 @@ -/************************************************************************* - * * - * Reflection Template Library (RTL) - Modern C++ Reflection Framework * - * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * - * * - * Copyright (c) 2025 Neeraj Singh * - * SPDX-License-Identifier: MIT * - * * - *************************************************************************/ - - -#pragma once - -#include "TypeId.h" -#include "Builder.h" -#include "ReflectionBuilder.hpp" - -namespace rtl -{ - namespace builder - { - inline CtorBuilder::CtorBuilder(const std::string_view pNamespace, const std::string_view pRecord, - const std::string_view pFunction, std::size_t pRecordId) - : ReflectionBuilder(pFunction, pRecordId, pNamespace, pRecord) { - } - - /* @method: build() - @param: none - @return: 'Function' object. - * accepts no arguments, builds copy constructor which takes const object source. - * called on object returned by 'RecordBuilder<_recordType>::constructor<...>()' - * template params <...>, explicitly specified. - * calling with zero template params will build the default constructor ie, 'RecordBuilder<_recordType>::constructor()' - */ template - inline const Function CtorBuilder::build() const - { - return buildConstructor<_recordType, _signature...>(); - } - } -} - - -namespace rtl -{ - namespace builder - { - inline Builder::Builder(std::size_t pRecordId, const std::string_view pFunction, const std::string_view pNamespace) - : ReflectionBuilder(pFunction, pRecordId, pNamespace) { - } - - /* @method: build() - @param: _returnType(*)(_signature...) - @return: 'Function' object. - * accepts all non-member and static-member function pointer. - * called on the objects returned by 'type::function()' & 'RecordBuilder<_recordType>::methodStatic(..)'. - * template params are auto deduced from the function pointer passed. - */ template - inline const Function Builder::build(_returnType(*pFunctor)(_signature...)) const - { - return buildFunctor(pFunctor); - } - } - - - namespace builder - { - inline Builder::Builder(std::size_t pRecordId, const std::string_view pFunction, const std::string_view pNamespace) - : ReflectionBuilder(pFunction, pRecordId, pNamespace) - { } - - /* @method: build() - @param: _returnType(*)() - @return: 'Function' object. - * accepts a non-member or static-member function pointer with no arguments. - * called on objects returned by 'type::function(..)' & 'RecordBuilder<_recordType>::methodStatic(..)' - * template param 'void' is explicitly specified. - */ template - inline const Function Builder::build(_returnType(*pFunctor)()) const - { - return buildFunctor(pFunctor); - } - } - - - namespace builder - { - template - inline Builder::Builder(std::size_t pRecordId, const std::string_view pFunction, const std::string_view pNamespace) - : ReflectionBuilder(pFunction, pRecordId, pNamespace) - { } - - - /* @method: build() - @param: _returnType(*)(_signature...) - @return: 'Function' object. - * it accepts a non-member or static-member function pointer. - * called on objects returned by 'type::function<...>(..)' & 'RecordBuilder<_recordType>::methodStatic<...>(..)'. - * template params are explicitly specified. - */ template - template - inline const Function Builder::build(_returnType(*pFunctor)(_signature...)) const - { - return buildFunctor(pFunctor); - } - } - - - namespace builder - { - inline Builder::Builder(const std::string_view pFunction, std::size_t pRecordId) - : ReflectionBuilder(pFunction, pRecordId) - { } - - /* @method: build() - @param: _returnType(_recordType::*)(_signature...) const. - @return: 'Function' object. - * accepts function pointer of a const-member-function with any signature. - * called on object returned by 'RecordBuilder<_recordType>::methodConst()' - * template params will be auto deduced from the function pointer passed. - */ template - inline const Function Builder::build(_returnType(_recordType::* pFunctor)(_signature...) const) const - { - return buildMethodFunctor(pFunctor); - } - } - - - namespace builder - { - inline Builder::Builder(const std::string_view pFunction, std::size_t pRecordId) - : ReflectionBuilder(pFunction, pRecordId) - { } - - /* @method: build() - @param: _returnType(_recordType::*)() const. - @return: 'Function' object. - * accepts a const-member-function pointer with no arguments. - * called on object returned by 'RecordBuilder<_recordType>::methodConst()' - * template param 'void' is explicitly specified. - */ template - inline const Function Builder::build(_returnType(_recordType::* pFunctor)() const) const - { - return buildMethodFunctor(pFunctor); - } - } - - - namespace builder - { - template - inline Builder::Builder(const std::string_view pFunction, std::size_t pRecordId) - : ReflectionBuilder(pFunction, pRecordId) - { } - - /* @method: build() - @param: _returnType(_recordType::*)(_signature...) const. - @return: 'Function' object. - * accepts a const-member-function pointer with any arguments. - * called on object returned by 'RecordBuilder<_recordType>::methodConst<...>()' - * template param are explicitly specified. - */ template - template - inline const Function Builder::build(_returnType(_recordType::* pFunctor)(_signature...) const) const - { - return buildMethodFunctor(pFunctor); - } - } - - - namespace builder - { - inline Builder::Builder(const std::string_view pFunction, std::size_t pRecordId) - : ReflectionBuilder(pFunction, pRecordId) - { } - - - /* @method: build() - @param: _returnType(_recordType::*)(_signature...) - @return: 'Function' object. - * accepts a non-const-member-function pointer with any arguments. - * called on object returned by 'RecordBuilder<_recordType>::method()' - * template params are auto deduced from the pointer passed. - */ template - inline const Function Builder::build(_returnType(_recordType::* pFunctor)(_signature...)) const - { - return buildMethodFunctor(pFunctor); - } - } - - - namespace builder - { - inline Builder::Builder(const std::string_view pFunction, std::size_t pRecordId) - : ReflectionBuilder(pFunction, pRecordId) - { } - - - /* @method: build() - @param: _returnType(_recordType::*)() - @return: 'Function' object. - * accepts a non-const-member-function pointer with no arguments. - * called on object returned by 'RecordBuilder<_recordType>::method()' - * template param 'void' is explicitly specified. - */ template - inline const Function Builder::build(_returnType(_recordType::* pFunctor)()) const - { - return buildMethodFunctor(pFunctor); - } - } - - - namespace builder - { - template - inline Builder::Builder(const std::string_view pFunction, std::size_t pRecordId) - : ReflectionBuilder(pFunction, pRecordId) - { } - - /* @method: build() - @param: _returnType(_recordType::*)(_signature...) - @return: 'Function' object. - * accepts a non-const-member-function pointer with any arguments. - * called on object returned by 'RecordBuilder<_recordType>::method<...>()' - * template params are explicitly specified. - */ template - template - inline const Function Builder::build(_returnType(_recordType::* pFunctor)(_signature...)) const - { - return buildMethodFunctor(pFunctor); - } - } -} \ No newline at end of file diff --git a/ReflectionTemplateLib/common/rtl_debug.hpp b/ReflectionTemplateLib/common/rtl_debug.hpp deleted file mode 100644 index 4d2b4739..00000000 --- a/ReflectionTemplateLib/common/rtl_debug.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once -// #include - -#ifdef RTL_DEBUG - -// Runs arbitrary code safely in Debug builds (single-statement safe) -#define RTL_DEBUG_ONLY(code) do { code } while(0) - -// Simple debug log -// #define RTL_LOG(msg) do { std::cout << "[RTL-DEBUG] " << msg << '\n'; } while(0) - -// Exception-free assert: if condition fails, prints message and returns error code -// #define RTL_ASSERT(cond, err_code) do { \ -// if (!(cond)) { \ -// std::cerr << "[RTL-ASSERT] " #cond " failed!\n"; \ -// return err_code; \ -// } \ -// } while(0) - -#else - -// Release builds: completely stripped out -#define RTL_DEBUG_ONLY(code) do {} while(0) -// #define RTL_LOG(msg) do {} while(0) -// #define RTL_ASSERT(cond, err_code) do {} while(0) - -#endif diff --git a/ReflectionTemplateLib/detail/inc/FunctionCaller.hpp b/ReflectionTemplateLib/detail/inc/FunctionCaller.hpp deleted file mode 100644 index a673afd5..00000000 --- a/ReflectionTemplateLib/detail/inc/FunctionCaller.hpp +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************* - * * - * Reflection Template Library (RTL) - Modern C++ Reflection Framework * - * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * - * * - * Copyright (c) 2025 Neeraj Singh * - * SPDX-License-Identifier: MIT * - * * - *************************************************************************/ - - -#pragma once - -#include "RObject.h" -#include "Function.h" -#include "FunctionCaller.h" -#include "FunctorContainer.h" - -namespace rtl::detail -{ - template - template - FORCE_INLINE Return FunctionCaller<_signature...>::call(_args&&...params) const - { - using Container = std::conditional_t...>, - FunctorContainer<_signature...>>; - - std::size_t index = m_function->hasSignatureId(Container::getContainerId()); - if (index != rtl::index_none) [[likely]] { - return Container::template forwardCall<_args...>(index, std::forward<_args>(params)...); - } - return { error::SignatureMismatch, RObject{} }; - } -} \ No newline at end of file diff --git a/ReflectionTemplateLib/detail/inc/FunctorId.h b/ReflectionTemplateLib/detail/inc/FunctorId.h deleted file mode 100644 index 5fee2669..00000000 --- a/ReflectionTemplateLib/detail/inc/FunctorId.h +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************* - * * - * Reflection Template Library (RTL) - Modern C++ Reflection Framework * - * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * - * * - * Copyright (c) 2025 Neeraj Singh * - * SPDX-License-Identifier: MIT * - * * - *************************************************************************/ - - -#pragma once - -#include "TypeId.h" -#include "Constants.h" - -namespace rtl -{ - namespace detail - { - /* @class: FunctorId - * 'FunctorId' object is generated for every functor (member/non-member function pointer) registered. - * acts as a hash-key to lookup a particular functor in the functor-table. - * first, using 'm_containerId', the functor-table container is found. - * once table is found, the functor is accessed at index 'm_index', (never fails, noexcept) - * 'FunctorId' generated for a each functor is unique, even for overloaded functions. - * multiple registartion of same functor will generate same duplicate 'FunctorId'. - */ struct FunctorId - { - //index of the functor in the functor-table. - std::size_t m_index; - - //return type-id of the functor registered. - std::size_t m_returnId; - - //if functor is a member-function, type id of class/struct it belongs to. - std::size_t m_recordId; - - //containerId of the functor-table. - std::size_t m_containerId; - - //signature of functor as string. platform dependent, may not be very much readable format. - std::string m_signature; - - GETTER(std::size_t, Index, m_index) - GETTER(std::size_t, ReturnId, m_returnId); - GETTER(std::size_t, RecordId, m_recordId); - GETTER(std::size_t, SignatureId, m_containerId) - GETTER(std::string, SignatureStr, m_signature) - - /* @method: getHashCode() - @return: std::size_t (a unique hash-code for a functor) - * 'm_containerId' will be same for functors(non-member) with same signatures. - * for member functions, a functor will have three atrributes - - signature - - whether it is const or non-const - - class/struct type - 'm_containerId' will be same for functors with same above attributes. - * every functor will have a distinct index in the functor-wrapped-lambda-table. - * so, combination of m_containerId & m_index is unique for every functor. - */ std::size_t getHashCode() const - { - return std::stoull(std::to_string(m_containerId) + - std::to_string(m_index) + - std::to_string(m_recordId) + - std::to_string(m_returnId)); - } - - const bool operator==(const FunctorId& pOther) const - { - return (m_index == pOther.m_index && m_returnId == pOther.m_returnId && - m_recordId == pOther.m_recordId && m_containerId == pOther.m_containerId && - m_signature == pOther.m_signature); - } - }; - } -} \ No newline at end of file diff --git a/ReflectionTemplateLib/detail/inc/MethodInvoker.hpp b/ReflectionTemplateLib/detail/inc/MethodInvoker.hpp deleted file mode 100644 index fb06f8cd..00000000 --- a/ReflectionTemplateLib/detail/inc/MethodInvoker.hpp +++ /dev/null @@ -1,148 +0,0 @@ -/************************************************************************* - * * - * Reflection Template Library (RTL) - Modern C++ Reflection Framework * - * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * - * * - * Copyright (c) 2025 Neeraj Singh * - * SPDX-License-Identifier: MIT * - * * - *************************************************************************/ - - -#pragma once - -#include "Method.h" -#include "RObject.h" -#include "MethodInvoker.h" -#include "MethodContainer.h" - -namespace rtl::detail -{ -/* @method: call() - @params: params... (corresponding to functor associated with 'm_method') - @return: RObject, indicating success of the reflected call. - * invokes non-static-member-function functor associated with 'm_method' on object 'm_target'. -*/ template - template - FORCE_INLINE Return DefaultInvoker<_signature...>::call(_args&& ...params) const noexcept - { - //Only static-member-functions have Qualifier- 'methodQ::None' - if (m_method->getQualifier() == methodQ::None) [[unlikely]] { - return static_cast(*m_method).bind().call(std::forward<_args>(params)...); - } - else if (m_target->isEmpty()) [[unlikely]] { - //if the target is empty. - return { error::EmptyRObject, RObject{} }; - } - else if (m_target->getTypeId() != m_method->getRecordTypeId()) [[unlikely]] { - //if the m_target's type-id & type-id of the 'class/struct' owner of the associated functor(m_method's) do not match. - return { error::TargetMismatch, RObject{} }; - } - else [[likely]] - { - if constexpr (sizeof...(_signature) == 0) { - // executes when bind doesn't have any explicit signature types specified. (e.g. perfect-forwaring) - return Invoker...>::invoke(*m_method, *m_target, std::forward<_args>(params)...); - } - else { - return Invoker<_signature...>::invoke(*m_method, *m_target, std::forward<_args>(params)...); - } - } - } - - - // Invoker struct's static method definition - template - template - template - FORCE_INLINE Return - DefaultInvoker<_signature...>::Invoker<_invokSignature...>::invoke(const Method& pMethod, - const RObject& pTarget, - _args&&... params) - { - using containerConst = detail::MethodContainer; - std::size_t constMethodIndex = pMethod.hasSignatureId(containerConst::getContainerId()); - - if (constMethodIndex != rtl::index_none) [[likely]] - { - return containerConst::template forwardCall<_args...>(pTarget, constMethodIndex, std::forward<_args>(params)...); - } - else [[unlikely]] - { - using containerNonConst = detail::MethodContainer; - std::size_t nonConstMethodIndex = pMethod.hasSignatureId(containerNonConst::getContainerId()); - - if (nonConstMethodIndex != rtl::index_none) - { - if (!pTarget.isConstCastSafe()) { - return { error::ConstOverloadMissing, RObject{} }; - } - return containerNonConst::template forwardCall<_args...>(pTarget, nonConstMethodIndex, std::forward<_args>(params)...); - } - } - return { error::SignatureMismatch, RObject{} }; - } -} - - -namespace rtl::detail -{ -/* @method: call() - @params: params... (corresponding to functor associated with 'm_method') - @return: RObject, indicating success of the reflected call. - * invokes non-static-member-function functor associated with 'm_method' on object 'm_target'. -*/ template - template - FORCE_INLINE Return NonConstInvoker<_signature...>::call(_args&& ...params) const noexcept - { - if (m_method->getQualifier() == methodQ::None) [[unlikely]] { - return static_cast(*m_method).bind().call(std::forward<_args>(params)...); - } - else if (m_target->isEmpty()) [[unlikely]] { - //if the target is empty. - return { error::EmptyRObject, RObject{} }; - } - else if (m_target->getTypeId() != m_method->getRecordTypeId()) [[unlikely]] { - //if the m_target's type-id & type-id of the 'class/struct' owner of the associated functor(m_method's) do not match. - return { error::TargetMismatch, RObject{} }; - } - else [[likely]] - { - if constexpr (sizeof...(_signature) == 0) { - return Invoker...>::invoke(*m_method, *m_target, std::forward<_args>(params)...); - } - else { - return Invoker<_signature...>::invoke(*m_method, *m_target, std::forward<_args>(params)...); - } - } - } - - - // Invoker struct's static method definition - template - template - template - FORCE_INLINE Return - NonConstInvoker<_signature...>::Invoker<_invokSignature...>::invoke(const Method& pMethod, - const RObject& pTarget, - _args&&... params) - { - using container0 = detail::MethodContainer; - const std::size_t index = pMethod.hasSignatureId(container0::getContainerId()); - if (index != rtl::index_none) [[likely]] { - return container0::template forwardCall<_args...>(pTarget, index, std::forward<_args>(params)...); - } - else - { - // check if the const-overload method is present. - using container2 = detail::MethodContainer; - std::size_t index = pMethod.hasSignatureId(container2::getContainerId()); - if (index != rtl::index_none) { - // So, const-overload is present and non-const overload is not registered or doesn't exists. - return { error::NonConstOverloadMissing, RObject{} }; - } - // else the signature might be wrong. - return { error::SignatureMismatch , RObject{} }; - } - } -} \ No newline at end of file diff --git a/ReflectionTemplateLib/detail/inc/SetupFunction.h b/ReflectionTemplateLib/detail/inc/SetupFunction.h deleted file mode 100644 index 493aa4a9..00000000 --- a/ReflectionTemplateLib/detail/inc/SetupFunction.h +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* - * * - * Reflection Template Library (RTL) - Modern C++ Reflection Framework * - * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * - * * - * Copyright (c) 2025 Neeraj Singh * - * SPDX-License-Identifier: MIT * - * * - *************************************************************************/ - - -#pragma once - -#include "FunctorId.h" - -namespace rtl { - - namespace detail - { - /* @struct: SetupFunction - @param: _derivedType (type which inherits this class) - * creates a functor-wrapped-lambda to perform call on the registered functor. - * adds it to the functor-container, maintains the already added functor set as well. - * deriving classes is FunctorContainer<...>, which must implement - - - std::size_t& _derived::getContainerId(); - - std::string _derivedType::getSignatureStr(); - - std::size_t& _derived::pushBack(std::function, - std::function, - std::function); - * sets up only non-member or static-member-function functors in table. - * called from 'ReflectionBuilder', as _derivedType member. - */ template - class SetupFunction - { - template - using FunctionLambda = std::function < Return(_signature...) >; - - template - static FunctionLambda<_signature...> getCaller(void(*pFunctor)(_signature...)); - - template - static FunctionLambda<_signature...> getCaller(_returnType(*pFunctor)(_signature...)); - - protected: - - template - static const detail::FunctorId addFunctor(_returnType(*pFunctor)(_signature...), std::size_t pRecordId); - }; - } -} \ No newline at end of file diff --git a/ReflectionTemplateLib/detail/inc/SetupMethod.h b/ReflectionTemplateLib/detail/inc/SetupMethod.h deleted file mode 100644 index ee521194..00000000 --- a/ReflectionTemplateLib/detail/inc/SetupMethod.h +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************* - * * - * Reflection Template Library (RTL) - Modern C++ Reflection Framework * - * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * - * * - * Copyright (c) 2025 Neeraj Singh * - * SPDX-License-Identifier: MIT * - * * - *************************************************************************/ - - -#pragma once - -#include "FunctorId.h" - -namespace rtl { - - namespace detail - { - /* @struct: SetupMethod - @param: _derivedType (type which inherits this class) - * creates a lambda to perform call on the registered functor. - * adds it to the functor-container, maintains the already added functor set as well. - * deriving classes is MethodContainer & - MethodContainer, which must implement - - - std::size_t& _derived::getContainerId(); - - std::string _derivedType::getSignatureStr(); - - std::size_t& _derived::pushBack(std::function < RObject (error&, const rtl::RObject&, _signature...) >, - std::function, - std::function); - * sets up only non-static-member-function functors in lambda table. - * called from 'ReflectionBuilder', as _derivedType member. - */ template - class SetupMethod - { - template - using MethodLambda = std::function < Return(const rtl::RObject&, _signature...) >; - - template - static MethodLambda<_signature...> getMethodCaller(_returnType(_recordType::* pFunctor)(_signature...)); - - template - static MethodLambda<_signature...> getMethodCaller(_returnType(_recordType::* pFunctor)(_signature...) const); - - template - static MethodLambda<_signature...> getMethodCaller(void(_recordType::* pFunctor)(_signature...)); - - template - static MethodLambda<_signature...> getMethodCaller(void(_recordType::* pFunctor)(_signature...) const); - - protected: - - template - static const detail::FunctorId addFunctor(_returnType(_recordType::* pFunctor)(_signature...)); - - template - static const detail::FunctorId addFunctor(_returnType(_recordType::* pFunctor)(_signature...) const); - }; - } -} \ No newline at end of file diff --git a/ReflectionTemplateLib/detail/inc/SetupMethod.hpp b/ReflectionTemplateLib/detail/inc/SetupMethod.hpp deleted file mode 100644 index 78979dae..00000000 --- a/ReflectionTemplateLib/detail/inc/SetupMethod.hpp +++ /dev/null @@ -1,260 +0,0 @@ -/************************************************************************* - * * - * Reflection Template Library (RTL) - Modern C++ Reflection Framework * - * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * - * * - * Copyright (c) 2025 Neeraj Singh * - * SPDX-License-Identifier: MIT * - * * - *************************************************************************/ - - -#pragma once - -#include "view.h" -#include "TypeId.h" -#include "SetupMethod.h" -#include "RObjectBuilder.hpp" - -namespace rtl -{ - namespace detail - { - - template - template - inline SetupMethod<_derivedType>::MethodLambda<_signature...> - SetupMethod<_derivedType>::getMethodCaller(void(_recordType::* pFunctor)(_signature...)) - { - /* a variable arguments lambda, which finally calls the 'pFunctor' with 'params...'. - this is stored in _derivedType's (MethodContainer) vector holding lambda's. - */ return [pFunctor](const RObject& pTargetObj, _signature&&...params)-> Return - { - if (!pTargetObj.isConstCastSafe()) [[unlikely]] { - return { error::IllegalConstCast, RObject{} }; - } - - _recordType& target = const_cast<_recordType&>(pTargetObj.view<_recordType>()->get()); - (target.*pFunctor)(std::forward<_signature>(params)...); - return { error::None, RObject{} }; - }; - } - - - template - template - inline SetupMethod<_derivedType>::MethodLambda<_signature...> - SetupMethod<_derivedType>::getMethodCaller(_returnType(_recordType::* pFunctor)(_signature...)) - { - /* a variable arguments lambda, which finally calls the 'pFunctor' with 'params...'. - this is stored in _derivedType's (MethodContainer) vector holding lambda's. - */ return [pFunctor](const RObject& pTargetObj, _signature&&...params)-> Return - { - if (!pTargetObj.isConstCastSafe()) [[unlikely]] { - return { error::IllegalConstCast, RObject{} }; - } - - constexpr bool isConstCastSafe = (!traits::is_const_v<_returnType>); - //'target' needs const_cast, since the functor is non-const-member-function. - _recordType& target = const_cast<_recordType&>(pTargetObj.view<_recordType>()->get()); - if constexpr (std::is_reference_v<_returnType>) - { - /* if the function returns reference, this block will be retained by compiler. - Note: reference to temporary or dangling is not checked here. - */ using _rawRetType = traits::raw_t<_returnType>; - const _rawRetType& retObj = (target.*pFunctor)(std::forward<_signature>(params)...); - return { error::None, - RObjectBuilder::template - build(&retObj, rtl::index_none, isConstCastSafe) - }; - } - else { - - auto&& retObj = (target.*pFunctor)(std::forward<_signature>(params)...); - using T = std::remove_cvref_t; - - return { error::None, - RObjectBuilder::template - build(std::forward(retObj), rtl::index_none, isConstCastSafe) - }; - } - }; - } - - - - template - template - inline SetupMethod<_derivedType>::MethodLambda<_signature...> - SetupMethod<_derivedType>::getMethodCaller(void(_recordType::* pFunctor)(_signature...) const) - { - /* a variable arguments lambda, which finally calls the 'pFunctor' with 'params...'. - this is stored in _derivedType's (MethodContainer) vector holding lambda's. - */ return [pFunctor](const RObject& pTargetObj, _signature&&...params)-> Return - { - const _recordType& target = pTargetObj.view<_recordType>()->get(); - (target.*pFunctor)(std::forward<_signature>(params)...); - return { error::None, RObject{} }; - }; - } - - - template - template - inline SetupMethod<_derivedType>::MethodLambda<_signature...> - SetupMethod<_derivedType>::getMethodCaller(_returnType(_recordType::* pFunctor)(_signature...) const) - { - /* a variable arguments lambda, which finally calls the 'pFunctor' with 'params...'. - this is stored in _derivedType's (MethodContainer) vector holding lambda's. - */ return [pFunctor](const RObject& pTargetObj, _signature&&...params)-> Return - { - constexpr bool isConstCastSafe = (!traits::is_const_v<_returnType>); - //'target' is const and 'pFunctor' is const-member-function. - const _recordType& target = pTargetObj.view<_recordType>()->get(); - if constexpr (std::is_reference_v<_returnType>) { - /* if the function returns reference, this block will be retained by compiler. - Note: reference to temporary or dangling is not checked here. - */ using _rawRetType = traits::raw_t<_returnType>; - const _rawRetType& retObj = (target.*pFunctor)(std::forward<_signature>(params)...); - return { error::None, - RObjectBuilder::template - build(&retObj, rtl::index_none, isConstCastSafe) - }; - } - else { - - auto&& retObj = (target.*pFunctor)(std::forward<_signature>(params)...); - using T = std::remove_cvref_t; - - return { error::None, - RObjectBuilder::template - build(std::forward(retObj), rtl::index_none, isConstCastSafe) - }; - } - }; - } - - - /* @method: addFunctor(). - @param: 'pFuntor' (a non-const, non-static-member function pointer). - '_derivedType' : class deriving this class ('MethodContainer'). - '_recordType' : the owner 'class/stuct' type of the functor. - '_returnType' : return type deduced from 'pFunctor'. - '_signature...' : function signature deduced from 'pFunctor'. - @return: 'FunctorId' object, a hash-key to lookup the lambda (functor-wrapped) in the _derivedType's lambda-table. - * adds lambda (functor-wrapped) in '_derivedType' (MethodContainer) and maintains functorSet. - * thread safe, multiple functors can be registered simultaneously. - */ template - template - inline const detail::FunctorId SetupMethod<_derivedType>::addFunctor(_returnType(_recordType::* pFunctor)(_signature...)) - { - /* set of already registered functors. (static life time). - used std::vector, efficient for small sets. std::set/map will be overhead. - */ static std::vector> functorSet; - - /* adds the generated functor index to the 'functorSet'. (thread safe). - called from '_derivedType' (MethodContainer) - */ const auto& updateIndex = [&](std::size_t pIndex)->void { - functorSet.emplace_back(pFunctor, pIndex); - }; - - /* checks if the 'pFunctor' is already present in 'functorSet'. (thread safe). - called from '_derivedType' ('FunctorContainer') - */ const auto& getIndex = [&]()->std::size_t - { - //linear search, efficient for small set. - for (const auto& fptr : functorSet) { - if (fptr.first == pFunctor) { - //functor already registered, return its 'index'. - return fptr.second; - } - } - //functor is not already registered, return '-1'. - return index_none; - }; - - //generate a type-id of '_returnType'. - const std::size_t retTypeId = TypeId>::get(); - //finally add the lambda 'functor' in 'MethodContainer' lambda vector and get the index. - - if constexpr (std::is_same_v<_returnType, void>) - { - const std::size_t index = _derivedType::pushBack(getMethodCaller(pFunctor), getIndex, updateIndex); - //construct the hash-key 'FunctorId' and return. - return detail::FunctorId{ - index, retTypeId, TypeId<_recordType>::get(), _derivedType::getContainerId(), - _derivedType::template getSignatureStr<_recordType, _returnType>() - }; - } - else - { - const std::size_t index = _derivedType::pushBack(getMethodCaller(pFunctor), getIndex, updateIndex); - //construct the hash-key 'FunctorId' and return. - return detail::FunctorId { - index, retTypeId, TypeId<_recordType>::get(), _derivedType::getContainerId(), - _derivedType::template getSignatureStr<_recordType, _returnType>() - }; - } - } - - - /* @method: addFunctor(). - @param: 'pFuntor' (a const, non-static-member function pointer). - '_derivedType' : class deriving this class ('MethodContainer'). - '_recordType' : the owner 'class/stuct' type of the functor. - '_returnType' : return type deduced from 'pFunctor'. - '_signature...' : function signature deduced from 'pFunctor'. - @return: 'FunctorId' object, a hash-key to lookup the lambda (containing functor) in the _derivedType's lambda table. - * adds lambda (containing functor) in '_derivedType' (MethodContainer) and maintains a functorSet. - * thread safe, multiple functors can be registered simultaneously. - */ template - template - inline const detail::FunctorId SetupMethod<_derivedType>::addFunctor(_returnType(_recordType::* pFunctor)(_signature...) const) - { - /* set of already registered functors. (static life time). - used std::vector, efficient for small sets. std::set/map will be overhead. - */ static std::vector> functorSet; - const auto& updateIndex = [&](std::size_t pIndex)->void { - functorSet.emplace_back(pFunctor, pIndex); - }; - - /* adds the generated functor index to the 'functorSet'. (thread safe). - called from '_derivedType' (MethodContainer) - */ const auto& getIndex = [&]()->std::size_t - { - //linear search, efficient for small set. - for (const auto& fptr : functorSet) { - if (fptr.first == pFunctor) { - //functor already registered, return its 'index'. - return fptr.second; - } - } - //functor is not already registered, return '-1'. - return index_none; - }; - - //generate a type-id of '_returnType'. - const std::size_t retTypeId = TypeId>::get(); - //finally add the lambda 'functor' in 'MethodContainer' lambda vector and get the index. - - if constexpr (std::is_same_v<_returnType, void>) - { - const std::size_t index = _derivedType::pushBack(getMethodCaller(pFunctor), getIndex, updateIndex); - //construct the hash-key 'FunctorId' and return. - return detail::FunctorId { - index, retTypeId, TypeId<_recordType>::get(), _derivedType::getContainerId(), - _derivedType::template getSignatureStr<_recordType, _returnType>() - }; - } - else - { - const std::size_t index = _derivedType::pushBack(getMethodCaller(pFunctor), getIndex, updateIndex); - //construct the hash-key 'FunctorId' and return. - return detail::FunctorId { - index, retTypeId, TypeId<_recordType>::get(), _derivedType::getContainerId(), - _derivedType::template getSignatureStr<_recordType, _returnType>() - }; - } - } - } -} \ No newline at end of file diff --git a/ReflectionTemplateLib/detail/src/CMakeLists.txt b/ReflectionTemplateLib/detail/src/CMakeLists.txt deleted file mode 100644 index 46ec416a..00000000 --- a/ReflectionTemplateLib/detail/src/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -# Create a variable containing the source files for your target -set(LOCAL_SOURCES - "${CMAKE_CURRENT_LIST_DIR}/CxxReflection.cpp" - "${CMAKE_CURRENT_LIST_DIR}/ReflectCast.cpp" - "${CMAKE_CURRENT_LIST_DIR}/RObjectConverters_string.cpp" -) - - -SET(LOCAL_HEADERS - - "${PROJECT_SOURCE_DIR}/detail/inc/CallReflector.h" - "${PROJECT_SOURCE_DIR}/detail/inc/CxxReflection.h" - "${PROJECT_SOURCE_DIR}/detail/inc/FunctionCaller.h" - "${PROJECT_SOURCE_DIR}/detail/inc/FunctionCaller.hpp" - "${PROJECT_SOURCE_DIR}/detail/inc/MethodInvoker.h" - "${PROJECT_SOURCE_DIR}/detail/inc/MethodInvoker.hpp" - "${PROJECT_SOURCE_DIR}/detail/inc/FunctorContainer.h" - "${PROJECT_SOURCE_DIR}/detail/inc/FunctorId.h" - "${PROJECT_SOURCE_DIR}/detail/inc/RObjectId.h" - "${PROJECT_SOURCE_DIR}/detail/inc/MethodContainer.h" - "${PROJECT_SOURCE_DIR}/detail/inc/ReflectCast.h" - "${PROJECT_SOURCE_DIR}/detail/inc/ReflectCast.hpp" - "${PROJECT_SOURCE_DIR}/detail/inc/ReflectCastUtil.h" - "${PROJECT_SOURCE_DIR}/detail/inc/ReflectionBuilder.h" - "${PROJECT_SOURCE_DIR}/detail/inc/ReflectionBuilder.hpp" - "${PROJECT_SOURCE_DIR}/detail/inc/SetupConstructor.h" - "${PROJECT_SOURCE_DIR}/detail/inc/SetupConstructor.hpp" - "${PROJECT_SOURCE_DIR}/detail/inc/SetupFunction.h" - "${PROJECT_SOURCE_DIR}/detail/inc/SetupFunction.hpp" - "${PROJECT_SOURCE_DIR}/detail/inc/SetupMethod.h" - "${PROJECT_SOURCE_DIR}/detail/inc/SetupMethod.hpp" - "${PROJECT_SOURCE_DIR}/detail/inc/TypeId.h" - "${PROJECT_SOURCE_DIR}/detail/inc/RObjectUPtr.h" - "${PROJECT_SOURCE_DIR}/detail/inc/RObjExtracter.h" - "${PROJECT_SOURCE_DIR}/detail/inc/RObjectBuilder.h" - "${PROJECT_SOURCE_DIR}/detail/inc/RObjectBuilder.hpp" -) - - -# Add any additional source files if needed -target_sources(ReflectionTemplateLib - PRIVATE - "${LOCAL_HEADERS}" - "${LOCAL_SOURCES}" -) - - -SOURCE_GROUP("Source Files\\Detail" FILES ${LOCAL_SOURCES}) -SOURCE_GROUP("Header Files\\Detail" FILES ${LOCAL_HEADERS}) \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/CMakeLists.txt b/ReflectionTemplateLib/rtl/CMakeLists.txt new file mode 100644 index 00000000..daa071c9 --- /dev/null +++ b/ReflectionTemplateLib/rtl/CMakeLists.txt @@ -0,0 +1,23 @@ +# ReflectionTemplateLibrary-CPP/ReflectionTemplateLib/rtl/CMakeLists.txt + +# Top-level headers in rtl/ (absolute paths) +set(LOCAL_HEADERS + "${CMAKE_CURRENT_SOURCE_DIR}/rtl.h" + "${CMAKE_CURRENT_SOURCE_DIR}/rtl_forward_decls.h" + "${CMAKE_CURRENT_SOURCE_DIR}/rtl_constants.h" + "${CMAKE_CURRENT_SOURCE_DIR}/rtl_errors.h" + "${CMAKE_CURRENT_SOURCE_DIR}/rtl_traits.h" + "${CMAKE_CURRENT_SOURCE_DIR}/rtl_typeid.h" +) + +target_sources(ReflectionTemplateLib PRIVATE ${LOCAL_HEADERS}) +source_group("Header Files\\RTL" FILES ${LOCAL_HEADERS}) + +# Add subdirectories +add_subdirectory(inc) +add_subdirectory(src) +add_subdirectory(builder) +add_subdirectory(cache) +add_subdirectory(detail) +add_subdirectory(erasure) +add_subdirectory(dispatch) \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/builder/Builder.h b/ReflectionTemplateLib/rtl/builder/Builder.h new file mode 100644 index 00000000..3b2880f1 --- /dev/null +++ b/ReflectionTemplateLib/rtl/builder/Builder.h @@ -0,0 +1,246 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "Function.h" +#include "ReflectionBuilder.h" + +namespace rtl::builder +{ + struct CtorBuilder : protected detail::ReflectionBuilder + { + CtorBuilder(const std::string_view pNamespace, const std::string_view pRecord, + const std::string_view pFunction, std::size_t pRecordId); + + template + const Function build() const; + }; + + +/* @struct: Builder + @param: specialized with member, + * member::NonConst - provides interface to register member funtion. + * member::Const - provides interface to register const-member funtions. + * member::Static - provides interface to register static member funtions. + * member::None - provides interface to register non-member funtions. + @param: + * _signature: arguments types of functions pointers or constructors (auto-deduced/explicitly-specified). + * provides interface to register all sort of functions, methods & constructors. + * every specialization has a 'build()' function, which accepts a function pointer. + * function pointer can be non-member or member(static/const/non-const) functions. +*/ template + struct Builder; +} + + +namespace rtl::builder +{ +/* @struct: Builder + * specialized specifically to register overloaded non-member & static member functions with no arguments. + * Objects of this class will be created & returned by the function, + * - type::function(..) + * with template parameter is only 'void', explicitly specified. +*/ template<> + struct Builder : protected detail::ReflectionBuilder + { + Builder(std::size_t pRecordId, const std::string_view pFunction, + const std::string_view pNamespace); + + template + const Function build(_returnType(*pFunctor)()) const; + }; + + +/* @struct: Builder + * specialized specifically to register overloaded non-member & static member functions with any arguments. + * Objects of this class will be created & returned by the function, + * - type::function<...>(..) + * with template parameters can be anything, explicitly specified. +*/ template + struct Builder : protected detail::ReflectionBuilder + { + Builder(std::size_t pRecordId, const std::string_view pFunction, + const std::string_view pNamespace); + + template + const Function build(_returnType(*pFunctor)(_signature...)) const; + }; + + +/* @struct: Builder + * specialized specifically to register non-member functions with any signature and with no overloads. + * Objects of this class will be created & returned by the function, + * - type::function(..) + * with no template parameters specified. +*/ template<> + struct Builder : protected detail::ReflectionBuilder + { + Builder(std::size_t pRecordId, const std::string_view pFunction, + const std::string_view pNamespace); + + template + const Function build(_returnType(*pFunctor)(_signature...)) const; + }; +} + + +namespace rtl::builder +{ +/* @struct: Builder + * specialized specifically to register overloaded non-member & static member functions with no arguments. + * Objects of this class will be created & returned by the function, + * - RecordBuilder<_recordType>::methodStatic(..) + * with template parameter is only 'void', explicitly specified. +*/ template<> + struct Builder : protected detail::ReflectionBuilder + { + traits::uid_t m_recordUid; + + Builder(traits::uid_t pRecordUid, const std::string_view pFunction, + std::size_t pRecordId, const std::string_view pNamespace); + + template + const Function build(_returnType(*pFunctor)()) const; + }; + + +/* @struct: Builder + * specialized specifically to register overloaded non-member & static member functions with any arguments. + * Objects of this class will be created & returned by the function, + * - RecordBuilder<_recordType>::methodStatic<...>(..) + * with template parameters can be anything, explicitly specified. +*/ template + struct Builder : protected detail::ReflectionBuilder + { + traits::uid_t m_recordUid; + + Builder(traits::uid_t pRecordUid, const std::string_view pFunction, + std::size_t pRecordId, const std::string_view pNamespace); + + template + const Function build(_returnType(*pFunctor)(_signature...)) const; + }; + + +/* @struct: Builder + * specialized specifically to register non-member functions with any signature and with no overloads. + * Objects of this class will be created & returned by the function, + * - RecordBuilder<_recordType>::methodStatic(..) + * with no template parameters specified. +*/ template<> + struct Builder : protected detail::ReflectionBuilder + { + traits::uid_t m_recordUid; + + Builder(traits::uid_t pRecordUid, const std::string_view pFunction, + std::size_t pRecordId, const std::string_view pNamespace); + + template + const Function build(_returnType(*pFunctor)(_signature...)) const; + }; +} + + +namespace rtl::builder +{ +/* @struct: Builder + * specialized specifically to register overloaded const-member-functions with no arguments. + * Objects of this class will be created & returned by function, + * - RecordBuilder<_recordType>::methodConst(..) + * with template parameters is only 'void' explicitly specified. +*/ template<> + struct Builder : protected detail::ReflectionBuilder + { + Builder(const std::string_view pFunction, std::size_t pRecordId); + + template + const Function build(_returnType(_recordType::* pFunctor)() const) const; + }; + + +/* @struct: Builder + * specialized specifically to register overloaded const-member-functions with any arguments. + * Objects of this class will be created & returned by function, + * - RecordBuilder<_recordType>::methodConst<...>(..) + * with template parameters can be anything, explicitly specified. +*/ template + struct Builder : protected detail::ReflectionBuilder + { + Builder(const std::string_view pFunction, std::size_t pRecordId); + + template + const Function build(_returnType(_recordType::* pFunctor)(_signature...) const) const; + }; + + +/* @struct: Builder + * specialized specifically to register non-overloaded const-member-functions with any arguments. + * Objects of this class will be created & returned by function, + * - RecordBuilder<_recordType>::methodConst() + * with no template parameters specified. +*/ template<> + struct Builder : protected detail::ReflectionBuilder + { + Builder(const std::string_view pFunction, std::size_t pRecordId); + + template + const Function build(_returnType(_recordType::* pFunctor)(_signature...) const) const; + }; +} + + +namespace rtl::builder +{ +/* @struct: Builder + * specialized specifically to register overloaded non-const-member-functions with no arguments. + * Objects of this class will be created & returned by function, + * - RecordBuilder<_recordType>::method(..) + * with template parameters is only 'void' explicitly specified. +*/ template<> + struct Builder : protected detail::ReflectionBuilder + { + Builder(const std::string_view pFunction, std::size_t pRecordId); + + template + const Function build(_returnType(_recordType::* pFunctor)()) const; + }; + + +/* @struct: Builder + * specialized specifically to register overloaded non-const-member-functions with no arguments. + * Objects of this class will be created & returned by function, + * - RecordBuilder<_recordType>::method(..) + * with template parameters is only 'void' explicitly specified. +*/ template + struct Builder : protected detail::ReflectionBuilder + { + Builder(const std::string_view pFunction, std::size_t pRecordId); + + template + const Function build(_returnType(_recordType::* pFunctor)(_signature...)) const; + }; + + +/* @struct: Builder + * specialized specifically to register non-overloaded non-const-member-functions and constructors with any arguments. + * Objects of this class will be created & returned by function, + * - RecordBuilder<_recordType>::method() - with no template parameters specified. + * - RecordBuilder<_recordType>::constructor<...>() - template parameters can be anything or none, explicitly specified. +*/ template<> + struct Builder : protected detail::ReflectionBuilder + { + Builder(const std::string_view pFunction, std::size_t pRecordId); + + template + const Function build(_returnType(_recordType::* pFunctor)(_signature...)) const; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/builder/Builder.hpp b/ReflectionTemplateLib/rtl/builder/Builder.hpp new file mode 100644 index 00000000..1b32da25 --- /dev/null +++ b/ReflectionTemplateLib/rtl/builder/Builder.hpp @@ -0,0 +1,294 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "Builder.h" +#include "ReflectionBuilder.hpp" + +namespace rtl::builder +{ + inline CtorBuilder::CtorBuilder(const std::string_view pNamespace, const std::string_view pRecord, + const std::string_view pFunction, std::size_t pRecordId) + : ReflectionBuilder(pFunction, pRecordId, pNamespace, pRecord) { + } + +/* @method: build() + @param: none + @return: 'Function' object. + * accepts no arguments, builds copy constructor which takes const object source. + * called on object returned by 'RecordBuilder<_recordType>::constructor<...>()' + * template params <...>, explicitly specified. + * calling with zero template params will build the default constructor ie, 'RecordBuilder<_recordType>::constructor()' +*/ template + inline const Function CtorBuilder::build() const + { + return buildConstructor<_recordType, _signature...>(); + } +} + + +namespace rtl::builder +{ + inline Builder::Builder(std::size_t pRecordId, const std::string_view pFunction, const std::string_view pNamespace) + : ReflectionBuilder(pFunction, pRecordId, pNamespace) { + } + +/* @method: build() + @param: _returnType(*)(_signature...) + @return: 'Function' object. + * accepts all non-member and static-member function pointer. + * called on the objects returned by 'type::function()' & 'RecordBuilder<_recordType>::methodStatic(..)'. + * template params are auto deduced from the function pointer passed. +*/ template + inline const Function Builder::build(_returnType(*pFunctor)(_signature...)) const + { + return buildFunctor(pFunctor, detail::member::None, traits::uid<>::none); + } +} + + +namespace rtl::builder +{ + inline Builder::Builder(std::size_t pRecordId, const std::string_view pFunction, const std::string_view pNamespace) + : ReflectionBuilder(pFunction, pRecordId, pNamespace) + { } + +/* @method: build() + @param: _returnType(*)() + @return: 'Function' object. + * accepts a non-member or static-member function pointer with no arguments. + * called on objects returned by 'type::function(..)' & 'RecordBuilder<_recordType>::methodStatic(..)' + * template param 'void' is explicitly specified. +*/ template + inline const Function Builder::build(_returnType(*pFunctor)()) const + { + return buildFunctor(pFunctor, detail::member::None, traits::uid<>::none); + } +} + + +namespace rtl::builder +{ + template + inline Builder::Builder(std::size_t pRecordId, const std::string_view pFunction, const std::string_view pNamespace) + : ReflectionBuilder(pFunction, pRecordId, pNamespace) + { } + + +/* @method: build() + @param: _returnType(*)(_signature...) + @return: 'Function' object. + * it accepts a non-member or static-member function pointer. + * called on objects returned by 'type::function<...>(..)' & 'RecordBuilder<_recordType>::methodStatic<...>(..)'. + * template params are explicitly specified. +*/ template + template + inline const Function Builder::build(_returnType(*pFunctor)(_signature...)) const + { + return buildFunctor(pFunctor, detail::member::None, traits::uid<>::none); + } +} + + +namespace rtl::builder +{ + inline Builder::Builder(traits::uid_t pRecordUid, const std::string_view pFunction, + std::size_t pRecordId, const std::string_view pNamespace) + : ReflectionBuilder(pFunction, pRecordId, pNamespace) + , m_recordUid(pRecordUid) + { } + +/* @method: build() + @param: _returnType(*)(_signature...) + @return: 'Function' object. + * accepts all non-member and static-member function pointer. + * called on the objects returned by 'type::function()' & 'RecordBuilder<_recordType>::methodStatic(..)'. + * template params are auto deduced from the function pointer passed. +*/ template + inline const Function Builder::build(_returnType(*pFunctor)(_signature...)) const + { + return buildFunctor(pFunctor, detail::member::Static, m_recordUid); + } +} + + +namespace rtl::builder +{ + inline Builder::Builder(traits::uid_t pRecordUid, const std::string_view pFunction, + std::size_t pRecordId, const std::string_view pNamespace) + : ReflectionBuilder(pFunction, pRecordId, pNamespace) + , m_recordUid(pRecordUid) + { } + +/* @method: build() + @param: _returnType(*)() + @return: 'Function' object. + * accepts a non-member or static-member function pointer with no arguments. + * called on objects returned by 'type::function(..)' & 'RecordBuilder<_recordType>::methodStatic(..)' + * template param 'void' is explicitly specified. +*/ template + inline const Function Builder::build(_returnType(*pFunctor)()) const + { + return buildFunctor(pFunctor, detail::member::Static, m_recordUid); + } +} + + +namespace rtl::builder +{ + template + inline Builder::Builder(traits::uid_t pRecordUid, const std::string_view pFunction, + std::size_t pRecordId, const std::string_view pNamespace) + : ReflectionBuilder(pFunction, pRecordId, pNamespace) + , m_recordUid(pRecordUid) + { } + + +/* @method: build() + @param: _returnType(*)(_signature...) + @return: 'Function' object. + * it accepts a non-member or static-member function pointer. + * called on objects returned by 'type::function<...>(..)' & 'RecordBuilder<_recordType>::methodStatic<...>(..)'. + * template params are explicitly specified. +*/ template + template + inline const Function Builder::build(_returnType(*pFunctor)(_signature...)) const + { + return buildFunctor(pFunctor, detail::member::Static, m_recordUid); + } +} + + +namespace rtl::builder +{ + inline Builder::Builder(const std::string_view pFunction, std::size_t pRecordId) + : ReflectionBuilder(pFunction, pRecordId) + { } + +/* @method: build() + @param: _returnType(_recordType::*)(_signature...) const. + @return: 'Function' object. + * accepts function pointer of a const-member-function with any signature. + * called on object returned by 'RecordBuilder<_recordType>::methodConst()' + * template params will be auto deduced from the function pointer passed. +*/ template + inline const Function Builder::build(_returnType(_recordType::* pFunctor)(_signature...) const) const + { + return buildMethodFunctor(pFunctor); + } +} + + +namespace rtl::builder +{ + inline Builder::Builder(const std::string_view pFunction, std::size_t pRecordId) + : ReflectionBuilder(pFunction, pRecordId) + { } + +/* @method: build() + @param: _returnType(_recordType::*)() const. + @return: 'Function' object. + * accepts a const-member-function pointer with no arguments. + * called on object returned by 'RecordBuilder<_recordType>::methodConst()' + * template param 'void' is explicitly specified. +*/ template + inline const Function Builder::build(_returnType(_recordType::* pFunctor)() const) const + { + return buildMethodFunctor(pFunctor); + } +} + + +namespace rtl::builder +{ + template + inline Builder::Builder(const std::string_view pFunction, std::size_t pRecordId) + : ReflectionBuilder(pFunction, pRecordId) + { } + +/* @method: build() + @param: _returnType(_recordType::*)(_signature...) const. + @return: 'Function' object. + * accepts a const-member-function pointer with any arguments. + * called on object returned by 'RecordBuilder<_recordType>::methodConst<...>()' + * template param are explicitly specified. +*/ template + template + inline const Function Builder::build(_returnType(_recordType::* pFunctor)(_signature...) const) const + { + return buildMethodFunctor(pFunctor); + } +} + + +namespace rtl::builder +{ + inline Builder::Builder(const std::string_view pFunction, std::size_t pRecordId) + : ReflectionBuilder(pFunction, pRecordId) + { } + + +/* @method: build() + @param: _returnType(_recordType::*)(_signature...) + @return: 'Function' object. + * accepts a non-const-member-function pointer with any arguments. + * called on object returned by 'RecordBuilder<_recordType>::method()' + * template params are auto deduced from the pointer passed. +*/ template + inline const Function Builder::build(_returnType(_recordType::* pFunctor)(_signature...)) const + { + return buildMethodFunctor(pFunctor); + } +} + + +namespace rtl::builder +{ + inline Builder::Builder(const std::string_view pFunction, std::size_t pRecordId) + : ReflectionBuilder(pFunction, pRecordId) + { } + + +/* @method: build() + @param: _returnType(_recordType::*)() + @return: 'Function' object. + * accepts a non-const-member-function pointer with no arguments. + * called on object returned by 'RecordBuilder<_recordType>::method()' + * template param 'void' is explicitly specified. +*/ template + inline const Function Builder::build(_returnType(_recordType::* pFunctor)()) const + { + return buildMethodFunctor(pFunctor); + } +} + + +namespace rtl::builder +{ + template + inline Builder::Builder(const std::string_view pFunction, std::size_t pRecordId) + : ReflectionBuilder(pFunction, pRecordId) + { } + +/* @method: build() + @param: _returnType(_recordType::*)(_signature...) + @return: 'Function' object. + * accepts a non-const-member-function pointer with any arguments. + * called on object returned by 'RecordBuilder<_recordType>::method<...>()' + * template params are explicitly specified. +*/ template + template + inline const Function Builder::build(_returnType(_recordType::* pFunctor)(_signature...)) const + { + return buildMethodFunctor(pFunctor); + } +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/builder/CMakeLists.txt b/ReflectionTemplateLib/rtl/builder/CMakeLists.txt new file mode 100644 index 00000000..03414d6b --- /dev/null +++ b/ReflectionTemplateLib/rtl/builder/CMakeLists.txt @@ -0,0 +1,27 @@ +# ReflectionTemplateLibrary-CPP/ReflectionTemplateLib/builder/CMakeLists.txt + +# Collect all headers in builder/ (absolute paths) +set(LOCAL_HEADERS + "${CMAKE_CURRENT_SOURCE_DIR}/Builder.h" + "${CMAKE_CURRENT_SOURCE_DIR}/Builder.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/ConstructorBuilder.h" + "${CMAKE_CURRENT_SOURCE_DIR}/FunctorContainer.h" + "${CMAKE_CURRENT_SOURCE_DIR}/MethodContainer.h" + "${CMAKE_CURRENT_SOURCE_DIR}/RecordBuilder.h" + "${CMAKE_CURRENT_SOURCE_DIR}/RecordBuilder.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/Reflect.h" + "${CMAKE_CURRENT_SOURCE_DIR}/Reflect.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/ReflectionBuilder.h" + "${CMAKE_CURRENT_SOURCE_DIR}/ReflectionBuilder.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/RObjectBuilder.h" + "${CMAKE_CURRENT_SOURCE_DIR}/RObjectBuilder.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/SetupConstructor.h" + "${CMAKE_CURRENT_SOURCE_DIR}/SetupConstructor.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/SetupFunction.h" + "${CMAKE_CURRENT_SOURCE_DIR}/SetupFunction.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/SetupMethod.h" + "${CMAKE_CURRENT_SOURCE_DIR}/SetupMethod.hpp" +) + +target_sources(ReflectionTemplateLib PRIVATE ${LOCAL_HEADERS}) +source_group("Header Files\\Builder" FILES ${LOCAL_HEADERS}) \ No newline at end of file diff --git a/ReflectionTemplateLib/builder/inc/ConstructorBuilder.h b/ReflectionTemplateLib/rtl/builder/ConstructorBuilder.h similarity index 93% rename from ReflectionTemplateLib/builder/inc/ConstructorBuilder.h rename to ReflectionTemplateLib/rtl/builder/ConstructorBuilder.h index 94e4ba3f..36acf76a 100644 --- a/ReflectionTemplateLib/builder/inc/ConstructorBuilder.h +++ b/ReflectionTemplateLib/rtl/builder/ConstructorBuilder.h @@ -11,7 +11,7 @@ #pragma once -#include "Constants.h" +#include "rtl_constants.h" namespace rtl { @@ -49,8 +49,8 @@ namespace rtl { /* @method: build() @param: none @return: 'Function' object. - * constructs temparory object of class Builder with given class/struct, namespace name & constructor type. - * forwards the call to Builder::build(). + * constructs temparory object of class Builder with given class/struct, namespace name & constructor type. + * forwards the call to Builder::build(). */ const Function build() const { // Check if the constructor is not deleted and publicly accessible (excluding default constructor). diff --git a/ReflectionTemplateLib/detail/inc/FunctorContainer.h b/ReflectionTemplateLib/rtl/builder/FunctorContainer.h similarity index 86% rename from ReflectionTemplateLib/detail/inc/FunctorContainer.h rename to ReflectionTemplateLib/rtl/builder/FunctorContainer.h index 425ad930..f2109e41 100644 --- a/ReflectionTemplateLib/detail/inc/FunctorContainer.h +++ b/ReflectionTemplateLib/rtl/builder/FunctorContainer.h @@ -15,11 +15,12 @@ #include #include -#include "Constants.h" +#include "rtl_constants.h" #include "CallReflector.h" #include "SetupFunction.h" #include "SetupConstructor.h" + namespace rtl { namespace detail @@ -29,24 +30,24 @@ namespace rtl { /* @class: FunctorContainer @param: '_signature...' (combination of any types) - * container class for holding lambda's wrapping functor, constructor calls of same signatures. + * container class for holding std::function, wrapping functor, constructor calls of same signatures. * maintains a std::vector with static lifetime. */ template class FunctorContainer : public SetupFunction>, public SetupConstructor>, public CallReflector> { - using FunctionLambda = std::function < Return(_signature...) >; + using FunctionLambda = std::function < Return(const FunctorId&, _signature...) >; public: //every FunctorContainer<...> will have a unique-id. - FORCE_INLINE static std::size_t getContainerId() { + ForceInline static std::size_t getContainerId() { static const std::size_t containerId = generate_unique_id(); return containerId; } //get the vector holding lambdas as 'const-ref' - FORCE_INLINE const static std::vector& getFunctors() { + ForceInline const static std::vector& getOverloads() { static std::vector& functorTable = getFunctorTable(); return functorTable; } @@ -67,10 +68,11 @@ namespace rtl { return functorTable; } + /* @method: pushBack @params: pFunctor (lambda containing functor or constructor call) - pGetIndex (lambda providing index if the functor is already registered) - pUpdate (lambda updating the already registered functors/ctor/d'tor set) + pGetIndex (lambda providing index if the functor is already registered) + pUpdate (lambda updating the already registered functors/ctor/d'tor set) @return: index of newly added or already existing lambda in vector 'm_functors'. */ static std::size_t pushBack(const FunctionLambda& pFunctor, std::function pGetIndex, diff --git a/ReflectionTemplateLib/detail/inc/MethodContainer.h b/ReflectionTemplateLib/rtl/builder/MethodContainer.h similarity index 74% rename from ReflectionTemplateLib/detail/inc/MethodContainer.h rename to ReflectionTemplateLib/rtl/builder/MethodContainer.h index 3a9ec85a..2568f716 100644 --- a/ReflectionTemplateLib/detail/inc/MethodContainer.h +++ b/ReflectionTemplateLib/rtl/builder/MethodContainer.h @@ -15,7 +15,7 @@ #include #include -#include "Constants.h" +#include "rtl_constants.h" #include "CallReflector.h" #include "SetupMethod.h" @@ -29,22 +29,22 @@ namespace rtl { //forward decl class ReflectionBuilder; - template + template class MethodContainer; - /* @class: MethodContainer + /* @class: MethodContainer @param: '_signature...' (combination of any types) * container class for holding lambda's wrapping non-const-member-function functor calls of same signatures. * maintains a std::vector with static lifetime. */ template - class MethodContainer : public SetupMethod>, - public CallReflector> + class MethodContainer : public SetupMethod>, + public CallReflector> { - using MethodLambda = std::function < Return (const rtl::RObject&, _signature...) >; + using MethodLambda = std::function < Return (const FunctorId&, const rtl::RObject&, _signature...) >; public: - //every MethodContainer will have a unique-id. + //every MethodContainer will have a unique-id. static std::size_t getContainerId() { //holds unique-id static const std::size_t containerId = generate_unique_id(); @@ -52,7 +52,7 @@ namespace rtl { } //get the vector holding lambdas as 'const-ref' - FORCE_INLINE static const std::vector& getMethodFunctors() { + ForceInline static const std::vector& getMethodFunctors() { static std::vector& functorTable = getFunctorTable(); return functorTable; } @@ -73,11 +73,12 @@ namespace rtl { return functorTable; } + /* @method: pushBack @params: pFunctor (lambda containing non-const-member-function functor call) - pGetIndex (lambda providing index if the functor is already registered) + pGetIndex (lambda providing lambdaIndex if the functor is already registered) pUpdate (lambda updating the already registered functors set) - @return: index of newly added or already existing lambda in vector 'm_methodPtrs'. + @return: lambdaIndex of newly added or already existing lambda in vector 'm_methodPtrs'. */ static std::size_t pushBack(const MethodLambda& pFunctor, std::function pGetIndex, std::function pUpdateIndex) @@ -97,34 +98,34 @@ namespace rtl { //friends :) friend ReflectionBuilder; - friend SetupMethod>; + friend SetupMethod>; }; } namespace detail { - /* @class: MethodContainer + /* @class: MethodContainer @param: '_signature...' (combination of any types) * container class for holding lambda's wrapping const-member-function functor calls of same signatures. * maintains a std::vector with static lifetime. */ template - class MethodContainer : public SetupMethod>, - public CallReflector> + class MethodContainer : public SetupMethod>, + public CallReflector> { - using MethodLambda = std::function < Return (const rtl::RObject&, _signature...) >; + using MethodLambda = std::function < Return (const FunctorId&, const rtl::RObject&, _signature...) >; public: - //every MethodContainer will have a unique-id. - FORCE_INLINE static std::size_t getContainerId() { + //every MethodContainer will have a unique-id. + ForceInline static std::size_t getContainerId() { //holds unique-id static const std::size_t containerId = generate_unique_id(); return containerId; } //get the vector holding lambdas as 'const-ref' - FORCE_INLINE static const std::vector& getMethodFunctors() { + ForceInline static const std::vector& getMethodFunctors() { static std::vector& functorTable = getFunctorTable(); return functorTable; } @@ -145,11 +146,12 @@ namespace rtl { return functorTable; } + /* @method: pushBack @params: pFunctor (lambda containing const-member-function functor call) - pGetIndex (lambda providing index if the functor is already registered) + pGetIndex (lambda providing lambdaIndex if the functor is already registered) pUpdate (lambda updating the already registered functors set) - @return: index of newly added or already existing lambda in vector 'm_methodPtrs'. + @return: lambdaIndex of newly added or already existing lambda in vector 'm_methodPtrs'. */ static std::size_t pushBack(const MethodLambda& pFunctor, std::function pGetIndex, std::function pUpdateIndex) @@ -169,7 +171,7 @@ namespace rtl { //friends :) friend ReflectionBuilder; - friend SetupMethod>; + friend SetupMethod>; }; } } \ No newline at end of file diff --git a/ReflectionTemplateLib/detail/inc/RObjectBuilder.h b/ReflectionTemplateLib/rtl/builder/RObjectBuilder.h similarity index 79% rename from ReflectionTemplateLib/detail/inc/RObjectBuilder.h rename to ReflectionTemplateLib/rtl/builder/RObjectBuilder.h index b847dacc..b5cd0750 100644 --- a/ReflectionTemplateLib/detail/inc/RObjectBuilder.h +++ b/ReflectionTemplateLib/rtl/builder/RObjectBuilder.h @@ -11,12 +11,10 @@ #pragma once -#include "rtl_traits.h" +#include -namespace rtl { - class RObject; - struct Return; -} +#include "rtl_traits.h" +#include "RObject.h" namespace rtl::detail { @@ -27,10 +25,10 @@ namespace rtl::detail RObjectBuilder(const RObjectBuilder&) = delete; template requires (_allocOn == alloc::Heap) - static RObject build(T&& pVal, std::size_t pClonerIndex, bool pIsConstCastSafe) noexcept; + static RObject build(T&& pVal, std::optional pClonerId, bool pIsConstCastSafe) noexcept; template requires (_allocOn == alloc::Stack) - static RObject build(T&& pVal, std::size_t pClonerIndex, bool pIsConstCastSafe) noexcept; + static RObject build(T&& pVal, std::optional pClonerId, bool pIsConstCastSafe) noexcept; }; } @@ -48,11 +46,11 @@ namespace rtl { if constexpr (std::is_same_v, char>) { return detail::RObjectBuilder::template - build(std::string_view(pArr, N - 1), rtl::index_none, !traits::is_const_v); + build(std::string_view(pArr, N - 1), std::nullopt, !traits::is_const_v); } else { return detail::RObjectBuilder>::template - build(std::vector(pArr, pArr + N), rtl::index_none, !traits::is_const_v); + build(std::vector(pArr, pArr + N), std::nullopt, !traits::is_const_v); } } @@ -64,13 +62,13 @@ namespace rtl if constexpr (traits::std_wrapper<_T>::type == detail::Wrapper::None) { return detail::RObjectBuilder::template - build(std::forward(pVal), rtl::index_none, !traits::is_const_v); + build(std::forward(pVal), std::nullopt, !traits::is_const_v); } else { constexpr bool isConstCastSafe = !traits::is_const_v::value_type>; return detail::RObjectBuilder::template - build(std::forward(pVal), rtl::index_none, isConstCastSafe); + build(std::forward(pVal), std::nullopt, isConstCastSafe); } } } \ No newline at end of file diff --git a/ReflectionTemplateLib/detail/inc/RObjectBuilder.hpp b/ReflectionTemplateLib/rtl/builder/RObjectBuilder.hpp similarity index 86% rename from ReflectionTemplateLib/detail/inc/RObjectBuilder.hpp rename to ReflectionTemplateLib/rtl/builder/RObjectBuilder.hpp index 5de6e142..e7b4cd91 100644 --- a/ReflectionTemplateLib/detail/inc/RObjectBuilder.hpp +++ b/ReflectionTemplateLib/rtl/builder/RObjectBuilder.hpp @@ -20,7 +20,7 @@ namespace rtl::detail { template - FORCE_INLINE const std::vector& getConverters() noexcept + ForceInline const std::vector& getConverters() noexcept { // extract wrapper info. using _W = traits::std_wrapper>; @@ -32,29 +32,29 @@ namespace rtl::detail template template requires (_allocOn == alloc::Heap) - FORCE_INLINE RObject RObjectBuilder::build(T&& pVal, std::size_t pClonerIndex, bool pIsConstCastSafe) noexcept + ForceInline RObject RObjectBuilder::build(T&& pVal, std::optional pClonerId, bool pIsConstCastSafe) noexcept { using _T = traits::raw_t; return RObject( std::any{ std::in_place_type>, RObjectUPtr<_T>(std::unique_ptr<_T>(static_cast<_T*>(pVal))) }, - RObjectId::create, alloc::Heap>(pClonerIndex, pIsConstCastSafe), + RObjectId::create, alloc::Heap>(pIsConstCastSafe, pClonerId), &getConverters>()); } template template requires (_allocOn == alloc::Stack) - FORCE_INLINE RObject RObjectBuilder::build(T&& pVal, std::size_t pClonerIndex, bool pIsConstCastSafe) noexcept + ForceInline RObject RObjectBuilder::build(T&& pVal, std::optional pClonerId, bool pIsConstCastSafe) noexcept { using _T = traits::raw_t; - constexpr bool isRawPointer = std::is_pointer_v>; + constexpr bool isRawPointer = std::is_pointer_v>; if constexpr (isRawPointer) { return RObject( std::any { static_cast(pVal) }, - RObjectId::create(pClonerIndex, pIsConstCastSafe), + RObjectId::create(pIsConstCastSafe, pClonerId), &getConverters() ); } else @@ -66,7 +66,7 @@ namespace rtl::detail std::in_place_type>, RObjectUPtr(std::move(pVal)) }, - RObjectId::create(pClonerIndex, pIsConstCastSafe), + RObjectId::create(pIsConstCastSafe, pClonerId), &getConverters() ); } else @@ -76,7 +76,7 @@ namespace rtl::detail std::in_place_type, std::forward(pVal) }, - RObjectId::create(pClonerIndex, pIsConstCastSafe), + RObjectId::create(pIsConstCastSafe, pClonerId), &getConverters() ); } } diff --git a/ReflectionTemplateLib/builder/inc/RecordBuilder.h b/ReflectionTemplateLib/rtl/builder/RecordBuilder.h similarity index 73% rename from ReflectionTemplateLib/builder/inc/RecordBuilder.h rename to ReflectionTemplateLib/rtl/builder/RecordBuilder.h index da6db803..f317ce8e 100644 --- a/ReflectionTemplateLib/builder/inc/RecordBuilder.h +++ b/ReflectionTemplateLib/rtl/builder/RecordBuilder.h @@ -46,23 +46,23 @@ namespace rtl { */ template struct MethodBuilder { - const Builder method(const std::string_view pFunction) const; + const Builder method(const std::string_view pFunction) const; - const Builder methodConst(const std::string_view pFunction) const; + const Builder methodConst(const std::string_view pFunction) const; - const Builder methodStatic(const std::string_view pFunction) const; + const Builder methodStatic(const std::string_view pFunction) const; template - const Builder method(const std::string_view pFunction) const; + const Builder method(const std::string_view pFunction) const; template - const Builder methodConst(const std::string_view pFunction) const; + const Builder methodConst(const std::string_view pFunction) const; template - const Builder methodStatic(const std::string_view pFunction) const; + const Builder methodStatic(const std::string_view pFunction) const; template - constexpr const ConstructorBuilder<_recordType, traits::remove_const_n_ref_t<_signature>...> constructor() const; + constexpr const ConstructorBuilder<_recordType, traits::remove_cref_t<_signature>...> constructor() const; }; } } \ No newline at end of file diff --git a/ReflectionTemplateLib/builder/inc/RecordBuilder.hpp b/ReflectionTemplateLib/rtl/builder/RecordBuilder.hpp similarity index 74% rename from ReflectionTemplateLib/builder/inc/RecordBuilder.hpp rename to ReflectionTemplateLib/rtl/builder/RecordBuilder.hpp index b05f5b0b..be365208 100644 --- a/ReflectionTemplateLib/builder/inc/RecordBuilder.hpp +++ b/ReflectionTemplateLib/rtl/builder/RecordBuilder.hpp @@ -41,7 +41,7 @@ namespace rtl::builder * template params <...> - any combination of parameters. */ template template - inline constexpr const ConstructorBuilder<_recordType, traits::remove_const_n_ref_t<_signature>...> MethodBuilder<_recordType>::constructor() const + inline constexpr const ConstructorBuilder<_recordType, traits::remove_cref_t<_signature>...> MethodBuilder<_recordType>::constructor() const { constexpr bool isDefaultCtor = (sizeof...(_signature) == 0); constexpr bool isCopyOrMoveCtor = (sizeof...(_signature) == 1 && traits::is_first_type_same_v<_recordType, _signature...>); @@ -51,27 +51,27 @@ namespace rtl::builder static_assert(!isCopyOrMoveCtor, "Copy/Move-constructor registration detected! It is implicitly registered with the Type."); static_assert(isDeclearedCtor, "Constructor with given signature is not valid or declearation not found."); - return ConstructorBuilder<_recordType, traits::remove_const_n_ref_t<_signature>...>(); + return ConstructorBuilder<_recordType, traits::remove_cref_t<_signature>...>(); } /* @method: methodStatic() @param: std::string, name of function as string. - @return: Builder + @return: Builder * registers only static member functions. * used for registering unique static member function, if overload exists, use templated version 'methodStatic<...>()'. * the 'build(..)' called on return object will accepts static member function pointer only. * compiler error on 'build(..)' if non-static member or non-member function pointer is passed. */ template - inline const Builder MethodBuilder<_recordType>::methodStatic(const std::string_view pFunction) const + inline const Builder MethodBuilder<_recordType>::methodStatic(const std::string_view pFunction) const { - return Builder(detail::TypeId<_recordType>::get(), pFunction, ""); + return Builder(traits::uid<_recordType>::value, pFunction, detail::TypeId<_recordType>::get(), ""); } /* @method: methodStatic<...>() @param: std::string, name of function as string. - @return: Builder + @return: Builder * registers only static member functions. * used for registering overloads, if unique member function, use non-templated version 'methodStatic()'. * template parameters must be explicitly specified, should be exactly same as the member-function being registered. @@ -79,43 +79,43 @@ namespace rtl::builder * compiler error on 'build(..)' if const member or non-member function pointer is passed. */ template template - inline const Builder MethodBuilder<_recordType>::methodStatic(const std::string_view pFunction) const + inline const Builder MethodBuilder<_recordType>::methodStatic(const std::string_view pFunction) const { - return Builder(detail::TypeId<_recordType>::get(), pFunction, ""); + return Builder(traits::uid<_recordType>::value, pFunction, detail::TypeId<_recordType>::get(), ""); } /* @method: method() @param: std::string, name of function as string. - @return: Builder + @return: Builder * registers non-const, non-static member functions. * the 'build(..)' called on return object will accepts non-const, non-static member-function-pointer only. * compiler error on 'build(..)' if const, static member or non-member function pointer is passed. */ template - inline const Builder MethodBuilder<_recordType>::method(const std::string_view pFunction) const + inline const Builder MethodBuilder<_recordType>::method(const std::string_view pFunction) const { - return Builder(pFunction, detail::TypeId<_recordType>::get()); + return Builder(pFunction, detail::TypeId<_recordType>::get()); } /* @method: methodConst() @param: std::string, name of function as string. - @return: Builder + @return: Builder * registers const member functions. * used for registering unique member function, if overload exists, use templated version 'methodConst<...>()'. * template parameters must be explicitly specified, should be exactly same as the member-function being registered. * the 'build(..)' called on return object will accepts non-const member-function-pointer only. * compiler error 'build(..)' if non-const, static member or non-member function pointer is passed. */ template - inline const Builder MethodBuilder<_recordType>::methodConst(const std::string_view pFunction) const + inline const Builder MethodBuilder<_recordType>::methodConst(const std::string_view pFunction) const { - return Builder(pFunction, detail::TypeId<_recordType>::get()); + return Builder(pFunction, detail::TypeId<_recordType>::get()); } /* @method: method() @param: std::string, name of function as string. - @return: Builder + @return: Builder * registers non-const member functions. * used for registering overloads, for unique member function, use non-templated version 'method()'. * template parameters must be explicitly specified, should be exactly same as the member-function being registered. @@ -123,15 +123,15 @@ namespace rtl::builder * compiler error on 'build(..)' if const, static member or non-member function pointer is passed. */ template template - inline const Builder MethodBuilder<_recordType>::method(const std::string_view pFunction) const + inline const Builder MethodBuilder<_recordType>::method(const std::string_view pFunction) const { - return Builder(pFunction, detail::TypeId<_recordType>::get()); + return Builder(pFunction, detail::TypeId<_recordType>::get()); } /* @method: methodConst<...>() @param: std::string, name of function as string. - @return: Builder + @return: Builder * registers const member functions. * used for registering overloads, for unique member function, use non-templated version 'methodConst()'. * template parameters must be explicitly specified, should be exactly same as the member-function being registered. @@ -139,8 +139,8 @@ namespace rtl::builder * compiler error on 'build(..)' if non-const, static member or non-member function pointer is passed. */ template template - inline const Builder MethodBuilder<_recordType>::methodConst(const std::string_view pFunction) const + inline const Builder MethodBuilder<_recordType>::methodConst(const std::string_view pFunction) const { - return Builder(pFunction, detail::TypeId<_recordType>::get()); + return Builder(pFunction, detail::TypeId<_recordType>::get()); } } \ No newline at end of file diff --git a/ReflectionTemplateLib/builder/inc/Reflect.h b/ReflectionTemplateLib/rtl/builder/Reflect.h similarity index 82% rename from ReflectionTemplateLib/builder/inc/Reflect.h rename to ReflectionTemplateLib/rtl/builder/Reflect.h index e187d34b..8c8bf1a4 100644 --- a/ReflectionTemplateLib/builder/inc/Reflect.h +++ b/ReflectionTemplateLib/rtl/builder/Reflect.h @@ -12,7 +12,7 @@ #pragma once #include -#include "Constants.h" +#include "rtl_constants.h" #include "Builder.h" namespace rtl::builder @@ -43,7 +43,7 @@ namespace rtl constexpr const builder::RecordBuilder<_recordType> record(const std::string_view pClass); template - constexpr const builder::Builder function(const std::string_view pFunction); + constexpr const builder::Builder function(const std::string_view pFunction); private: @@ -79,7 +79,11 @@ namespace rtl } template - constexpr const builder::Builder function(const std::string_view pFunction) { + constexpr const builder::Builder function(const std::string_view pFunction) + { + constexpr bool hasConstRValueRef = ((std::is_const_v> && std::is_rvalue_reference_v<_signature>) || ...); + static_assert(!hasConstRValueRef, "Registration of functions with 'const T&&' parameters is not allowed."); + return ns().function<_signature...>(pFunction); } }; diff --git a/ReflectionTemplateLib/builder/inc/Reflect.hpp b/ReflectionTemplateLib/rtl/builder/Reflect.hpp similarity index 85% rename from ReflectionTemplateLib/builder/inc/Reflect.hpp rename to ReflectionTemplateLib/rtl/builder/Reflect.hpp index 07cda31d..0e0e54f1 100644 --- a/ReflectionTemplateLib/builder/inc/Reflect.hpp +++ b/ReflectionTemplateLib/rtl/builder/Reflect.hpp @@ -40,14 +40,14 @@ namespace rtl /* @function: function() @param: std::string (name of the function). - @return: Builder + @return: Builder * registers only non-member functions. * the 'build(..)' called on return object accepts non-member function pointer only. * compiler error on 'build(..)' if member function pointer is passed. */ template<> - inline const builder::Builder type_ns::function(const std::string_view pFunction) + inline const builder::Builder type_ns::function(const std::string_view pFunction) { - return builder::Builder(detail::TypeId<>::None, pFunction, m_namespace); + return builder::Builder(detail::TypeId<>::None, pFunction, m_namespace); } @@ -66,15 +66,15 @@ namespace rtl /* @method: function<...>() @param: std::string (name of function) - @return: Builder + @return: Builder * registers only non-member functions. * used for registering overloads, if unique member function, use non-templated version 'function()'. * template parameters must be explicitly specified, should be exactly same as the function being registered. * the 'build(..)' called on return object accepts non-member function pointer only. * compiler error on 'build(..)' if any member function pointer is passed. */ template - inline constexpr const builder::Builder type_ns::function(const std::string_view pFunction) + inline constexpr const builder::Builder type_ns::function(const std::string_view pFunction) { - return builder::Builder(detail::TypeId<>::None, pFunction, m_namespace); + return builder::Builder(detail::TypeId<>::None, pFunction, m_namespace); } } \ No newline at end of file diff --git a/ReflectionTemplateLib/detail/inc/ReflectionBuilder.h b/ReflectionTemplateLib/rtl/builder/ReflectionBuilder.h similarity index 96% rename from ReflectionTemplateLib/detail/inc/ReflectionBuilder.h rename to ReflectionTemplateLib/rtl/builder/ReflectionBuilder.h index abc75d98..708b1793 100644 --- a/ReflectionTemplateLib/detail/inc/ReflectionBuilder.h +++ b/ReflectionTemplateLib/rtl/builder/ReflectionBuilder.h @@ -12,6 +12,7 @@ #pragma once #include "Function.h" +#include "rtl_constants.h" namespace rtl { @@ -40,7 +41,7 @@ namespace rtl { //adds 'pFunctor' to the 'FunctorContainer'. template - const Function buildFunctor(_returnType(*pFunctor)(_signature...)) const; + const Function buildFunctor(_returnType(*pFunctor)(_signature...), member pMemberType, traits::uid_t pRecordUid) const; //adds 'pFunctor' to the 'MethodContainer'. template diff --git a/ReflectionTemplateLib/detail/inc/ReflectionBuilder.hpp b/ReflectionTemplateLib/rtl/builder/ReflectionBuilder.hpp similarity index 78% rename from ReflectionTemplateLib/detail/inc/ReflectionBuilder.hpp rename to ReflectionTemplateLib/rtl/builder/ReflectionBuilder.hpp index 29e96bb4..1a5c96dc 100644 --- a/ReflectionTemplateLib/detail/inc/ReflectionBuilder.hpp +++ b/ReflectionTemplateLib/rtl/builder/ReflectionBuilder.hpp @@ -39,11 +39,11 @@ namespace rtl::detail * accepts only a non-member or static-member function pointer. * builds the 'Function' object containing hash-key & meta-data for the given functor. */ template - inline const Function ReflectionBuilder::buildFunctor(_returnType(*pFunctor)(_signature...)) const + inline const Function ReflectionBuilder::buildFunctor(_returnType(*pFunctor)(_signature...), member pMemberType, traits::uid_t pRecordUid) const { using Container = FunctorContainer< traits::remove_const_if_not_reference<_signature>...>; - const FunctorId& functorId = Container::template addFunctor<_returnType, _signature...>(pFunctor, m_recordId); - return Function(m_namespace, m_record, m_function, functorId, m_recordId, methodQ::None); + auto [typeMeta, functorId] = Container::template addFunctor<_returnType, _signature...>(pFunctor, pRecordUid, m_recordId, pMemberType); + return Function(m_namespace, m_record, m_function, typeMeta, functorId, m_recordId, pMemberType); } @@ -57,9 +57,9 @@ namespace rtl::detail */ template inline const Function ReflectionBuilder::buildMethodFunctor(_returnType(_recordType::* pFunctor)(_signature...)) const { - using Container = MethodContainer...>; - const FunctorId& functorId = Container::template addFunctor<_recordType, _returnType, _signature...>(pFunctor); - return Function(m_namespace, m_record, m_function, functorId, m_recordId, methodQ::NonConst); + using Container = MethodContainer...>; + auto [typeMeta, functorId] = Container::template addFunctor<_recordType, _returnType, _signature...>(pFunctor); + return Function(m_namespace, m_record, m_function, typeMeta, functorId, m_recordId, member::NonConst); } @@ -73,9 +73,9 @@ namespace rtl::detail */ template inline const Function ReflectionBuilder::buildMethodFunctor(_returnType(_recordType::* pFunctor)(_signature...) const) const { - using Container = MethodContainer...>; - const FunctorId& functorId = Container::template addFunctor<_recordType, _returnType, _signature...>(pFunctor); - return Function(m_namespace, m_record, m_function, functorId, m_recordId, methodQ::Const); + using Container = MethodContainer...>; + auto [typeMeta, functorId] = Container::template addFunctor<_recordType, _returnType, _signature...>(pFunctor); + return Function(m_namespace, m_record, m_function, typeMeta, functorId, m_recordId, member::Const); } @@ -87,10 +87,10 @@ namespace rtl::detail */ template inline const Function ReflectionBuilder::buildConstructor() const { - using Container = FunctorContainer < rtl::alloc, std::size_t, traits::remove_const_if_not_reference<_ctorSignature>... > ; + using Container = FunctorContainer < rtl::alloc, FunctorId, traits::remove_const_if_not_reference<_ctorSignature>... > ; const FunctorId& functorId = Container::template addConstructor<_recordType, _ctorSignature...>(); - const FunctorId& copyCtorId = traits::Cloner::template addCopyConstructor<_recordType, const RObject&>(); - const Function& ctorFunction = Function(m_namespace, m_record, m_function, functorId, m_recordId, methodQ::None); + const FunctorId& copyCtorId = traits::Cloner::template addCopyConstructor<_recordType, RObject, alloc>(); + const Function& ctorFunction = Function(m_namespace, m_record, m_function, rtl::type_meta(), functorId, m_recordId, member::None); ctorFunction.getFunctorIds().push_back(copyCtorId); return ctorFunction; diff --git a/ReflectionTemplateLib/detail/inc/SetupConstructor.h b/ReflectionTemplateLib/rtl/builder/SetupConstructor.h similarity index 83% rename from ReflectionTemplateLib/detail/inc/SetupConstructor.h rename to ReflectionTemplateLib/rtl/builder/SetupConstructor.h index 44d06345..ee41ec5b 100644 --- a/ReflectionTemplateLib/detail/inc/SetupConstructor.h +++ b/ReflectionTemplateLib/rtl/builder/SetupConstructor.h @@ -11,12 +11,12 @@ #pragma once + #include "FunctorId.h" +#include "rtl_forward_decls.h" namespace rtl { - class RObject; - namespace detail { /* @struct: SetupConstructor @@ -28,13 +28,15 @@ namespace rtl { class SetupConstructor { template - using CtorLambda = std::function < Return(alloc, std::size_t, _signature...) >; + using CtorLambda = std::function < Return(FunctorId, alloc, FunctorId, _signature...) >; + + using CopyCtorLambda = std::function < Return(const FunctorId&, const RObject&, alloc) >; template static CtorLambda<_signature...> getConstructorCaller(); - template - static CtorLambda<_signature...> getCopyConstructorCaller(); + template + static CopyCtorLambda getCopyConstructorCaller(); protected: diff --git a/ReflectionTemplateLib/detail/inc/SetupConstructor.hpp b/ReflectionTemplateLib/rtl/builder/SetupConstructor.hpp similarity index 76% rename from ReflectionTemplateLib/detail/inc/SetupConstructor.hpp rename to ReflectionTemplateLib/rtl/builder/SetupConstructor.hpp index e2d025be..880127e4 100644 --- a/ReflectionTemplateLib/detail/inc/SetupConstructor.hpp +++ b/ReflectionTemplateLib/rtl/builder/SetupConstructor.hpp @@ -11,6 +11,7 @@ #pragma once #include +#include #include "RObjectBuilder.hpp" #include "SetupConstructor.h" @@ -22,7 +23,7 @@ namespace rtl::detail inline SetupConstructor<_derivedType>::CtorLambda<_signature...> SetupConstructor<_derivedType>::getConstructorCaller() { - return [](alloc pAllocType, std::size_t pClonerIndex, _signature&&...params)-> Return + return [](const FunctorId& pFunctorId, alloc pAllocType, const FunctorId& pClonerId, _signature&&...params)-> Return { if constexpr (sizeof...(_signature) == 0 && !std::is_default_constructible_v<_recordType>) { //default constructor, private or deleted. @@ -32,24 +33,27 @@ namespace rtl::detail { if (pAllocType == alloc::Stack) { - if constexpr (!std::is_copy_constructible_v<_recordType>) { + if constexpr (!std::is_copy_constructible_v<_recordType>) + { return { error::TypeNotCopyConstructible, RObject{} }; } - else { + else + { return { error::None, RObjectBuilder<_recordType>::template - build(_recordType(std::forward<_signature>(params)...), pClonerIndex, true) + build(_recordType(std::forward<_signature>(params)...), pClonerId, true) }; } } - else if (pAllocType == alloc::Heap) { + else if (pAllocType == alloc::Heap) + { return { error::None, RObjectBuilder<_recordType*>::template - build(new _recordType(std::forward<_signature>(params)...), pClonerIndex, true) + build(new _recordType(std::forward<_signature>(params)...), pClonerId, true) }; } } @@ -60,13 +64,13 @@ namespace rtl::detail template - template - inline SetupConstructor<_derivedType>::CtorLambda<_signature...> + template + inline SetupConstructor<_derivedType>::CopyCtorLambda SetupConstructor<_derivedType>::getCopyConstructorCaller() { if constexpr (std::is_copy_constructible_v<_recordType>) { - return [](alloc pAllocOn, std::size_t pClonerIndex, const RObject& pOther) -> Return + return [](const FunctorId& pFunctorId, const RObject& pOther, alloc pAllocOn) -> Return { const auto& srcObj = pOther.view<_recordType>()->get(); switch (pAllocOn) @@ -74,12 +78,12 @@ namespace rtl::detail case alloc::Stack: return { error::None, - RObjectBuilder<_recordType>::template build(_recordType(srcObj), pClonerIndex, true) + RObjectBuilder<_recordType>::template build(_recordType(srcObj), pFunctorId, true) }; case alloc::Heap: return { error::None, - RObjectBuilder<_recordType*>::template build(new _recordType(srcObj), pClonerIndex, true) + RObjectBuilder<_recordType*>::template build(new _recordType(srcObj), pFunctorId, true) }; default: return { @@ -91,7 +95,7 @@ namespace rtl::detail } else { - return [](alloc pAllocOn, std::size_t pClonerIndex, const RObject&) -> Return + return [](const FunctorId& pFunctorId, const RObject& pOther, alloc pAllocOn) -> Return { return { error::TypeNotCopyConstructible, @@ -115,6 +119,7 @@ namespace rtl::detail inline const detail::FunctorId SetupConstructor<_derivedType>::addConstructor() { std::size_t recordId = TypeId<_recordType>::get(); + std::size_t returnId = recordId; std::size_t containerId = _derivedType::getContainerId(); std::size_t hashKey = std::stoull(std::to_string(containerId) + std::to_string(recordId)); @@ -133,9 +138,17 @@ namespace rtl::detail }; //add the lambda in 'FunctorContainer'. - std::size_t index = _derivedType::pushBack(getConstructorCaller<_recordType, _signature...>(), getIndex, updateIndex); - const auto& signatureStr = _derivedType::template getSignatureStr<_recordType>(true); - return detail::FunctorId(index, recordId, recordId, containerId, signatureStr); + auto lambdaIndex = _derivedType::pushBack(getConstructorCaller<_recordType, _signature...>(), getIndex, updateIndex); + + return detail::FunctorId { + + lambdaIndex, + returnId, + recordId, + containerId, + _derivedType::template getSignatureStr<_recordType>(true), + nullptr//&lambdaCache + }; } @@ -144,6 +157,7 @@ namespace rtl::detail inline const detail::FunctorId SetupConstructor<_derivedType>::addCopyConstructor() { std::size_t recordId = TypeId<_recordType>::get(); + std::size_t returnId = recordId; std::size_t containerId = _derivedType::getContainerId(); std::size_t hashKey = std::stoull(std::to_string(containerId) + std::to_string(recordId)); @@ -161,9 +175,22 @@ namespace rtl::detail return (itr != ctorSet.end() ? itr->second : index_none); }; + //auto& lambdaCache = lambda_function::get<_signature...>(); + //const auto& pushLambdaHopper = [&]()-> std::size_t + //{ + // return lambdaCache.push_cloner<_recordType>(); + //}; + //add the lambda in 'FunctorContainer'. - std::size_t index = _derivedType::pushBack(getCopyConstructorCaller<_recordType, _signature...>(), getIndex, updateIndex); - const auto& signatureStr = _derivedType::template getSignatureStr<_recordType>(true); - return detail::FunctorId(index, recordId, recordId, containerId, signatureStr); + auto lambdaIndex = _derivedType::pushBack(getCopyConstructorCaller<_recordType>(), getIndex, updateIndex); + return detail::FunctorId { + + lambdaIndex, + returnId, + recordId, + containerId, + _derivedType::template getSignatureStr<_recordType>(true), + nullptr//&lambdaCache + }; } } \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/builder/SetupFunction.h b/ReflectionTemplateLib/rtl/builder/SetupFunction.h new file mode 100644 index 00000000..d32553cc --- /dev/null +++ b/ReflectionTemplateLib/rtl/builder/SetupFunction.h @@ -0,0 +1,47 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "rtl_forward_decls.h" + +namespace rtl::detail +{ +/* @struct: SetupFunction + @param: _derivedType (type which inherits this class) + * creates a functor-wrapped-lambda to perform call on the registered functor. + * adds it to the functor-container, maintains the already added functor set as well. + * deriving classes is FunctorContainer<...>, which must implement - + - std::size_t& _derived::getContainerId(); + - std::string _derivedType::getSignatureStr(); + - std::size_t& _derived::pushBack(std::function, + std::function, + std::function); + * sets up only non-member or static-member-function functors in table. + * called from 'ReflectionBuilder', as _derivedType member. +*/ template + class SetupFunction + { + template + using FunctionLambda = std::function < Return(const FunctorId&, _signature...) >; + + template + static FunctionLambda<_signature...> getCaller(void(*pFunctor)(_signature...)); + + template + static FunctionLambda<_signature...> getCaller(_returnType(*pFunctor)(_signature...)); + + protected: + + template + static std::pair addFunctor(_returnType(*pFunctor)(_signature...), traits::uid_t pRecordUid, std::size_t pRecordId, member pMemberType); + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/detail/inc/SetupFunction.hpp b/ReflectionTemplateLib/rtl/builder/SetupFunction.hpp similarity index 60% rename from ReflectionTemplateLib/detail/inc/SetupFunction.hpp rename to ReflectionTemplateLib/rtl/builder/SetupFunction.hpp index 07b9931d..cb866535 100644 --- a/ReflectionTemplateLib/detail/inc/SetupFunction.hpp +++ b/ReflectionTemplateLib/rtl/builder/SetupFunction.hpp @@ -11,9 +11,15 @@ #pragma once +#include + +#include "type_meta.hpp" + #include "SetupFunction.h" #include "RObjectBuilder.hpp" +#include "FunctorId.hpp" + namespace rtl { namespace detail @@ -23,9 +29,13 @@ namespace rtl inline SetupFunction<_derivedType>::FunctionLambda<_signature...> SetupFunction<_derivedType>::getCaller(void(*pFunctor)(_signature...)) { - return [pFunctor](_signature&&... params) -> Return + return [](const FunctorId& pFunctorId, _signature&&... params) -> Return { - pFunctor(std::forward<_signature>(params)...); + auto fptr = pFunctorId.get_lambda_function<_signature...>() + ->template get_hopper() + .f_ptr(); + + fptr(std::forward<_signature>(params)...); return { error::None, RObject{} }; }; } @@ -38,28 +48,32 @@ namespace rtl { /* a variable arguments lambda, which finally calls the 'pFunctor' with 'params...'. this is stored in _derivedType's (FunctorContainer) vector holding lambda's. - */ return [pFunctor](_signature&&...params)-> Return + */ return [](const FunctorId& pFunctorId, _signature&&...params)-> Return { + auto fptr = pFunctorId.get_lambda_function<_signature...>() + ->template get_hopper<_returnType>() + .f_ptr(); + constexpr bool isConstCastSafe = (!traits::is_const_v<_returnType>); if constexpr (std::is_reference_v<_returnType>) { /* if the function returns reference, this block will be retained by compiler. Note: reference to temporary or dangling is not checked here. */ using _rawRetType = traits::raw_t<_returnType>; - const _rawRetType& retObj = pFunctor(std::forward<_signature>(params)...); + const _rawRetType& retObj = fptr(std::forward<_signature>(params)...); return { error::None, RObjectBuilder::template - build(&retObj, rtl::index_none, isConstCastSafe) + build(&retObj, std::nullopt, isConstCastSafe) }; } else { //if the function returns anything (not refrence), this block will be retained by compiler. - auto&& retObj = pFunctor(std::forward<_signature>(params)...); + auto&& retObj = fptr(std::forward<_signature>(params)...); using T = std::remove_cvref_t; return { error::None, RObjectBuilder::template - build(std::forward(retObj), rtl::index_none, isConstCastSafe) + build(std::forward(retObj), std::nullopt, isConstCastSafe) }; } }; @@ -76,43 +90,40 @@ namespace rtl * thread safe, multiple functors can be registered simultaneously. */ template template - inline const detail::FunctorId SetupFunction<_derivedType>::addFunctor(_returnType(*pFunctor)(_signature...), std::size_t pRecordId) + inline std::pair + SetupFunction<_derivedType>::addFunctor(_returnType(*pFunctor)(_signature...), traits::uid_t pRecordUid, std::size_t pRecordId, member pMemberType) { - /* set of already registered functors. (static life time). - used std::vector, since std::set/map are not designed for function pointers - */ static std::vector> functorSet; - - /* adds the generated functor index to the 'functorSet'. (thread safe). - called from '_derivedType' ('FunctorContainer') - */ const auto& updateIndex = [&](std::size_t pIndex)->void - { - functorSet.emplace_back(pFunctor, pIndex); + rtl::type_meta typeMeta; + const auto& updateIndex = [&](std::size_t pIndex)-> void { + typeMeta = rtl::type_meta::add_function(pFunctor, pRecordUid, pMemberType, pIndex); }; - /* checks if the 'pFunctor' is already present in 'functorSet'. (thread safe). - called from '_derivedType' ('FunctorContainer') - */ const auto& getIndex = [&]()-> std::size_t + const auto& getIndex = [&]()-> std::size_t { - //linear search, efficient for small set. - for (const auto& fptr : functorSet) { - if (fptr.first == pFunctor) { - //functor already registered, return its 'index'. - return fptr.second; - } + auto& functorCache = cache::function_ptr<_returnType, _signature...>::instance(); + auto [functor, lambdaIndex] = functorCache.find(pFunctor); + if (lambdaIndex != rtl::index_none) { + typeMeta = rtl::type_meta(*functor); } - //functor is not already registered, return '-1'. - return rtl::index_none; + return lambdaIndex; }; //generate a type-id of '_returnType'. - const std::size_t retTypeId = TypeId>::get(); + const std::size_t returnId = TypeId>::get(); //finally add the lambda 'functor' in 'FunctorContainer' lambda vector and get the index. - const std::size_t index = _derivedType::pushBack(getCaller(pFunctor), getIndex, updateIndex); + auto lambdaIndex = _derivedType::pushBack(getCaller(pFunctor), getIndex, updateIndex); //construct the hash-key 'FunctorId' and return. - return detail::FunctorId{ - index, retTypeId, pRecordId, _derivedType::getContainerId(), - _derivedType::template getSignatureStr<_returnType>() + return { + typeMeta, + FunctorId { + lambdaIndex, + returnId, + pRecordId, + _derivedType::getContainerId(), + _derivedType::template getSignatureStr<_returnType>(), + &(typeMeta.get_lambda()) + } }; } } diff --git a/ReflectionTemplateLib/rtl/builder/SetupMethod.h b/ReflectionTemplateLib/rtl/builder/SetupMethod.h new file mode 100644 index 00000000..6b177d54 --- /dev/null +++ b/ReflectionTemplateLib/rtl/builder/SetupMethod.h @@ -0,0 +1,57 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "rtl_forward_decls.h" + +namespace rtl::detail { + +/* @struct: SetupMethod + @param: _derivedType (type which inherits this class) + * creates a lambda to perform call on the registered functor. + * adds it to the functor-container, maintains the already added functor set as well. + * deriving classes is MethodContainer & + MethodContainer, which must implement - + - std::size_t& _derived::getContainerId(); + - std::string _derivedType::getSignatureStr(); + - std::size_t& _derived::pushBack(std::function < RObject (error&, const rtl::RObject&, _signature...) >, + std::function, + std::function); + * sets up only non-static-member-function functors in lambda table. + * called from 'ReflectionBuilder', as _derivedType member. +*/ template + class SetupMethod + { + template + using MethodLambda = std::function < Return(const FunctorId&, const rtl::RObject&, _signature...) >; + + template + static MethodLambda<_signature...> getMethodCaller(_returnType(_recordType::* pFunctor)(_signature...)); + + template + static MethodLambda<_signature...> getMethodCaller(_returnType(_recordType::* pFunctor)(_signature...) const); + + template + static MethodLambda<_signature...> getMethodCaller(void(_recordType::* pFunctor)(_signature...)); + + template + static MethodLambda<_signature...> getMethodCaller(void(_recordType::* pFunctor)(_signature...) const); + + protected: + + template + static std::pair addFunctor(_returnType(_recordType::* pFunctor)(_signature...)); + + template + static std::pair addFunctor(_returnType(_recordType::* pFunctor)(_signature...) const); + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/builder/SetupMethod.hpp b/ReflectionTemplateLib/rtl/builder/SetupMethod.hpp new file mode 100644 index 00000000..58638616 --- /dev/null +++ b/ReflectionTemplateLib/rtl/builder/SetupMethod.hpp @@ -0,0 +1,254 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include + +#include "view.h" +#include "rtl_typeid.h" +#include "SetupMethod.h" +#include "RObjectBuilder.hpp" + +#include "type_meta.hpp" + +#include "FunctorId.hpp" + +namespace rtl::detail +{ + template + template + inline SetupMethod<_derivedType>::MethodLambda<_signature...> + SetupMethod<_derivedType>::getMethodCaller(void(_recordType::* pFunctor)(_signature...)) + { + /* a variable arguments lambda, which finally calls the 'pFunctor' with 'params...'. + this is stored in _derivedType's (MethodContainer) vector holding lambda's. + */ return [](const FunctorId& pFunctorId, const RObject& pTargetObj, _signature&&...params)-> Return + { + auto fptr = pFunctorId.get_lambda_method<_recordType, _signature...>() + ->template get_hopper() + .f_ptr(); + + if (!pTargetObj.isConstCastSafe()) [[unlikely]] { + return { error::IllegalConstCast, RObject{} }; + } + + _recordType& target = const_cast<_recordType&>(pTargetObj.view<_recordType>()->get()); + (target.*fptr)(std::forward<_signature>(params)...); + return { error::None, RObject{} }; + }; + } + + + template + template + inline SetupMethod<_derivedType>::MethodLambda<_signature...> + SetupMethod<_derivedType>::getMethodCaller(_returnType(_recordType::* pFunctor)(_signature...)) + { + /* a variable arguments lambda, which finally calls the 'pFunctor' with 'params...'. + this is stored in _derivedType's (MethodContainer) vector holding lambda's. + */ return [](const FunctorId& pFunctorId, const RObject& pTargetObj, _signature&&...params)-> Return + { + auto fptr = pFunctorId.get_lambda_method<_recordType, _signature...>() + ->template get_hopper<_returnType>() + .f_ptr(); + + if (!pTargetObj.isConstCastSafe()) [[unlikely]] { + return { error::IllegalConstCast, RObject{} }; + } + + constexpr bool isConstCastSafe = (!traits::is_const_v<_returnType>); + //'target' needs const_cast, since the functor is non-const-member-function. + _recordType& target = const_cast<_recordType&>(pTargetObj.view<_recordType>()->get()); + if constexpr (std::is_reference_v<_returnType>) + { + /* if the function returns reference, this block will be retained by compiler. + Note: reference to temporary or dangling is not checked here. + */ using _rawRetType = traits::raw_t<_returnType>; + const _rawRetType& retObj = (target.*fptr)(std::forward<_signature>(params)...); + return { error::None, + RObjectBuilder::template + build(&retObj, std::nullopt, isConstCastSafe) + }; + } + else { + + auto&& retObj = (target.*fptr)(std::forward<_signature>(params)...); + using T = std::remove_cvref_t; + + return { error::None, + RObjectBuilder::template + build(std::forward(retObj), std::nullopt, isConstCastSafe) + }; + } + }; + } + + + template + template + inline SetupMethod<_derivedType>::MethodLambda<_signature...> + SetupMethod<_derivedType>::getMethodCaller(void(_recordType::* pFunctor)(_signature...) const) + { + /* a variable arguments lambda, which finally calls the 'pFunctor' with 'params...'. + this is stored in _derivedType's (MethodContainer) vector holding lambda's. + */ return [](const FunctorId& pFunctorId, const RObject& pTargetObj, _signature&&...params)-> Return + { + auto fptr = pFunctorId.get_lambda_method() + ->template get_hopper() + .f_ptr(); + + const _recordType& target = pTargetObj.view<_recordType>()->get(); + (target.*fptr)(std::forward<_signature>(params)...); + return { error::None, RObject{} }; + }; + } + + + template + template + inline SetupMethod<_derivedType>::MethodLambda<_signature...> + SetupMethod<_derivedType>::getMethodCaller(_returnType(_recordType::* pFunctor)(_signature...) const) + { + /* a variable arguments lambda, which finally calls the 'pFunctor' with 'params...'. + this is stored in _derivedType's (MethodContainer) vector holding lambda's. + */ return [](const FunctorId& pFunctorId, const RObject& pTargetObj, _signature&&...params)-> Return + { + auto fptr = pFunctorId.get_lambda_method() + ->template get_hopper<_returnType>() + .f_ptr(); + + constexpr bool isConstCastSafe = (!traits::is_const_v<_returnType>); + //'target' is const and 'pFunctor' is const-member-function. + const _recordType& target = pTargetObj.view<_recordType>()->get(); + if constexpr (std::is_reference_v<_returnType>) { + /* if the function returns reference, this block will be retained by compiler. + Note: reference to temporary or dangling is not checked here. + */ using _rawRetType = traits::raw_t<_returnType>; + const _rawRetType& retObj = (target.*fptr)(std::forward<_signature>(params)...); + return { error::None, + RObjectBuilder::template + build(&retObj, std::nullopt, isConstCastSafe) + }; + } + else { + + auto&& retObj = (target.*fptr)(std::forward<_signature>(params)...); + using T = std::remove_cvref_t; + + return { error::None, + RObjectBuilder::template + build(std::forward(retObj), std::nullopt, isConstCastSafe) + }; + } + }; + } + + +/* @method: addFunctor(). + @param: 'pFuntor' (a non-const, non-static-member function pointer). + '_derivedType' : class deriving this class ('MethodContainer'). + '_recordType' : the owner 'class/stuct' type of the functor. + '_returnType' : return type deduced from 'pFunctor'. + '_signature...' : function signature deduced from 'pFunctor'. + @return: 'FunctorId' object, a hash-key to lookup the lambda (functor-wrapped) in the _derivedType's lambda-table. + * adds lambda (functor-wrapped) in '_derivedType' (MethodContainer) and maintains functorSet. + * thread safe, multiple functors can be registered simultaneously. +*/ template + template + inline std::pair SetupMethod<_derivedType>::addFunctor(_returnType(_recordType::* pFunctor)(_signature...)) + { + rtl::type_meta typeMeta; + const auto& updateIndex = [&](std::size_t pIndex)-> void + { + typeMeta = rtl::type_meta::add_method(pFunctor, pIndex); + }; + + const auto& getIndex = [&]()-> std::size_t + { + auto& functorCache = cache::method_ptr<_recordType, _returnType, _signature...>::instance(); + auto [functor, lambdaIndex] = functorCache.find(pFunctor); + + if (lambdaIndex != rtl::index_none) { + typeMeta = rtl::type_meta(*functor); + } + return lambdaIndex; + }; + + //generate a type-id of '_returnType'. + const std::size_t retTypeId = TypeId>::get(); + //finally add the lambda 'functor' in 'MethodContainer' lambda vector and get the index. + + auto lambdaIndex = _derivedType::pushBack(getMethodCaller(pFunctor), getIndex, updateIndex); + //construct the hash-key 'FunctorId' and return. + return { + typeMeta, + FunctorId { + lambdaIndex, + retTypeId, + TypeId<_recordType>::get(), + _derivedType::getContainerId(), + _derivedType::template getSignatureStr<_recordType, _returnType>(), + &(typeMeta.get_lambda()) + } + }; + } + + +/* @method: addFunctor(). + @param: 'pFuntor' (a const, non-static-member function pointer). + '_derivedType' : class deriving this class ('MethodContainer'). + '_recordType' : the owner 'class/stuct' type of the functor. + '_returnType' : return type deduced from 'pFunctor'. + '_signature...' : function signature deduced from 'pFunctor'. + @return: 'FunctorId' object, a hash-key to lookup the lambda (containing functor) in the _derivedType's lambda table. + * adds lambda (containing functor) in '_derivedType' (MethodContainer) and maintains a functorSet. + * thread safe, multiple functors can be registered simultaneously. +*/ template + template + inline std::pair SetupMethod<_derivedType>::addFunctor(_returnType(_recordType::* pFunctor)(_signature...) const) + { + rtl::type_meta typeMeta; + const auto& updateIndex = [&](std::size_t pIndex)-> void { + typeMeta = rtl::type_meta::add_method(pFunctor, pIndex); + }; + + const auto& getIndex = [&]()-> std::size_t + { + auto& functorCache = cache::method_ptr::instance(); + auto [functor, lambdaIndex] = functorCache.find(pFunctor); + + if (lambdaIndex != rtl::index_none) { + typeMeta = rtl::type_meta(*functor); + } + return lambdaIndex; + }; + + //generate a type-id of '_returnType'. + const std::size_t retTypeId = TypeId>::get(); + //finally add the lambda 'functor' in 'MethodContainer' lambda vector and get the index. + + auto lambdaIndex = _derivedType::pushBack(getMethodCaller(pFunctor), getIndex, updateIndex); + + //construct the hash-key 'FunctorId' and return. + return { + typeMeta, + FunctorId { + lambdaIndex, + retTypeId, + TypeId<_recordType>::get(), + _derivedType::getContainerId(), + _derivedType::template getSignatureStr<_recordType, _returnType>(), + &(typeMeta.get_lambda()) + } + }; + } +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/cache/CMakeLists.txt b/ReflectionTemplateLib/rtl/cache/CMakeLists.txt new file mode 100644 index 00000000..b301f6a4 --- /dev/null +++ b/ReflectionTemplateLib/rtl/cache/CMakeLists.txt @@ -0,0 +1,14 @@ +# ReflectionTemplateLibrary-CPP/ReflectionTemplateLib/cache/CMakeLists.txt + +# Collect headers (absolute paths) +set(LOCAL_HEADERS + "${CMAKE_CURRENT_SOURCE_DIR}/cache_lambda_method.h" + "${CMAKE_CURRENT_SOURCE_DIR}/cache_lambda_function.h" + + "${CMAKE_CURRENT_SOURCE_DIR}/cache_method_ptr.h" + "${CMAKE_CURRENT_SOURCE_DIR}/cache_function_ptr.h" + "${CMAKE_CURRENT_SOURCE_DIR}/cache_method_ptr_const.h" +) + +target_sources(ReflectionTemplateLib PRIVATE ${LOCAL_HEADERS}) +source_group("Header Files\\Cache" FILES ${LOCAL_HEADERS}) \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/cache/cache_function_ptr.h b/ReflectionTemplateLib/rtl/cache/cache_function_ptr.h new file mode 100644 index 00000000..ea9baa22 --- /dev/null +++ b/ReflectionTemplateLib/rtl/cache/cache_function_ptr.h @@ -0,0 +1,61 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include + +#include "function_ptr.h" + +namespace rtl::cache +{ + template + struct function_ptr + { + using function_t = dispatch::function_ptr; + + static const function_ptr& instance() + { + static function_ptr instance_; + return instance_; + } + + const dispatch::functor& push(return_t(*fptr)(signature_t...), traits::uid_t p_record_uid, detail::member member_kind, std::size_t lambda_index) const + { + m_cache.emplace_back(std::make_pair(function_t(fptr, p_record_uid, member_kind), lambda_index)); + return m_cache.back().first; + } + + std::pair find(return_t(*fptr)(signature_t...)) const + { + for (auto& itr : m_cache) + { + const auto& functor = itr.first; + if (functor.is_same(fptr)) { + return { &itr.first, itr.second }; + } + } + return { nullptr, rtl::index_none }; + } + + function_ptr(function_ptr&&) = delete; + function_ptr(const function_ptr&) = delete; + function_ptr& operator=(function_ptr&&) = delete; + function_ptr& operator=(const function_ptr&) = delete; + + private: + + // No reallocation occurs; original objects stay intact + mutable std::list> m_cache; + + function_ptr() = default; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/cache/cache_lambda_function.h b/ReflectionTemplateLib/rtl/cache/cache_lambda_function.h new file mode 100644 index 00000000..370b2677 --- /dev/null +++ b/ReflectionTemplateLib/rtl/cache/cache_lambda_function.h @@ -0,0 +1,54 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include + +#include "lambda_function.h" +#include "aware_return.h" + +namespace rtl::cache +{ + template + struct lambda_function + { + static const lambda_function& instance() + { + static const lambda_function instance_; + return instance_; + } + + std::pair push(const dispatch::functor& p_functor) const + { + m_erasure_cache.emplace_back(dispatch::aware_return()); + + const dispatch::erasure_base& eb = m_erasure_cache.back(); + + m_cache.push_back(dispatch::lambda_function(p_functor, eb)); + + return { &m_cache.back(), &eb }; + } + + lambda_function(lambda_function&&) = delete; + lambda_function(const lambda_function&) = delete; + lambda_function& operator=(lambda_function&&) = delete; + lambda_function& operator=(const lambda_function&) = delete; + + private: + + // No reallocation occurs; original objects stay intact + mutable std::list> m_cache; + mutable std::list> m_erasure_cache; + + lambda_function() = default; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/cache/cache_lambda_method.h b/ReflectionTemplateLib/rtl/cache/cache_lambda_method.h new file mode 100644 index 00000000..b50b4781 --- /dev/null +++ b/ReflectionTemplateLib/rtl/cache/cache_lambda_method.h @@ -0,0 +1,55 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include + +#include "lambda_method.h" +#include "aware_return_n_target.h" +#include "aware_return_n_target_const.h" + +namespace rtl::cache +{ + template + struct lambda_method + { + static const lambda_method& instance() + { + static const lambda_method instance_; + return instance_; + } + + std::pair push(const dispatch::functor& p_functor) const + { + m_erasure_cache.emplace_back(dispatch::aware_return_n_target()); + + auto& eb = m_erasure_cache.back(); + eb.init_base(); + m_cache.push_back(dispatch::lambda_method(p_functor, eb)); + + return { &m_cache.back(), &eb }; + } + + lambda_method(lambda_method&&) = delete; + lambda_method(const lambda_method&) = delete; + lambda_method& operator=(lambda_method&&) = delete; + lambda_method& operator=(const lambda_method&) = delete; + + private: + + // No reallocation occurs; original objects stay intact + mutable std::list> m_cache; + mutable std::list> m_erasure_cache; + + lambda_method() = default; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/cache/cache_method_ptr.h b/ReflectionTemplateLib/rtl/cache/cache_method_ptr.h new file mode 100644 index 00000000..8fd115e2 --- /dev/null +++ b/ReflectionTemplateLib/rtl/cache/cache_method_ptr.h @@ -0,0 +1,63 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include + +#include "method_ptr.h" + +namespace rtl::cache +{ + template + struct method_ptr + { + using method_t = dispatch::method_ptr; + + using functor_t = return_t(record_t::*)(signature_t...); + + static const method_ptr& instance() + { + static const method_ptr instance_; + return instance_; + } + + const dispatch::functor& push(functor_t fptr, std::size_t lambda_index) const + { + m_cache.emplace_back(std::make_pair(method_t(fptr), lambda_index)); + return m_cache.back().first; + } + + std::pair find(functor_t fptr) const + { + for (auto& itr : m_cache) + { + const auto& functor = itr.first; + if (functor.is_same(fptr)) { + return { &itr.first, itr.second }; + } + } + return { nullptr, rtl::index_none }; + } + + method_ptr(method_ptr&&) = delete; + method_ptr(const method_ptr&) = delete; + method_ptr& operator=(method_ptr&&) = delete; + method_ptr& operator=(const method_ptr&) = delete; + + private: + + // No reallocation occurs; original objects stay intact + mutable std::list> m_cache; + + method_ptr() = default; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/cache/cache_method_ptr_const.h b/ReflectionTemplateLib/rtl/cache/cache_method_ptr_const.h new file mode 100644 index 00000000..2fb9a1a0 --- /dev/null +++ b/ReflectionTemplateLib/rtl/cache/cache_method_ptr_const.h @@ -0,0 +1,63 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include + +#include "method_ptr_const.h" + +namespace rtl::cache +{ + template + struct method_ptr + { + using method_t = dispatch::method_ptr; + + using functor_t = return_t(record_t::*)(signature_t...) const; + + static const method_ptr& instance() + { + static const method_ptr instance_; + return instance_; + } + + const dispatch::functor& push(functor_t fptr, std::size_t lambda_index) const + { + m_cache.emplace_back(std::make_pair(method_t(fptr), lambda_index)); + return m_cache.back().first; + } + + std::pair find(functor_t fptr) const + { + for (auto& itr : m_cache) + { + const auto& functor = itr.first; + if (functor.is_same(fptr)) { + return { &itr.first, itr.second }; + } + } + return { nullptr, rtl::index_none }; + } + + method_ptr(method_ptr&&) = delete; + method_ptr(const method_ptr&) = delete; + method_ptr& operator=(method_ptr&&) = delete; + method_ptr& operator=(const method_ptr&) = delete; + + private: + + // No reallocation occurs; original objects stay intact + mutable std::list> m_cache; + + method_ptr() = default; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/detail/CMakeLists.txt b/ReflectionTemplateLib/rtl/detail/CMakeLists.txt new file mode 100644 index 00000000..c99483ce --- /dev/null +++ b/ReflectionTemplateLib/rtl/detail/CMakeLists.txt @@ -0,0 +1,10 @@ +# ReflectionTemplateLibrary-CPP/ReflectionTemplateLib/detail/CMakeLists.txt + +# Make the 'inc' folder visible as a public include dir +target_include_directories(ReflectionTemplateLib + PUBLIC + "${CMAKE_CURRENT_SOURCE_DIR}/inc" +) + +add_subdirectory(inc) +add_subdirectory(src) \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/detail/inc/CMakeLists.txt b/ReflectionTemplateLib/rtl/detail/inc/CMakeLists.txt new file mode 100644 index 00000000..feb99088 --- /dev/null +++ b/ReflectionTemplateLib/rtl/detail/inc/CMakeLists.txt @@ -0,0 +1,23 @@ +# ReflectionTemplateLibrary-CPP/ReflectionTemplateLib/detail/inc/CMakeLists.txt + +# All headers in this folder (absolute paths) +set(LOCAL_HEADERS + "${CMAKE_CURRENT_SOURCE_DIR}/ConversionUtils.h" + "${CMAKE_CURRENT_SOURCE_DIR}/CxxReflection.h" + "${CMAKE_CURRENT_SOURCE_DIR}/FunctorId.h" + "${CMAKE_CURRENT_SOURCE_DIR}/FunctorId.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/ReflectCast.h" + "${CMAKE_CURRENT_SOURCE_DIR}/ReflectCast.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/ReflectCastUtil.h" + "${CMAKE_CURRENT_SOURCE_DIR}/RObjectId.h" + "${CMAKE_CURRENT_SOURCE_DIR}/RObjectUPtr.h" + "${CMAKE_CURRENT_SOURCE_DIR}/RObjExtracter.h" + "${CMAKE_CURRENT_SOURCE_DIR}/CallReflector.h" + "${CMAKE_CURRENT_SOURCE_DIR}/FunctionCaller.h" + "${CMAKE_CURRENT_SOURCE_DIR}/FunctionCaller.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/MethodInvoker.h" + "${CMAKE_CURRENT_SOURCE_DIR}/MethodInvoker.hpp" +) + +target_sources(ReflectionTemplateLib PRIVATE ${LOCAL_HEADERS}) +source_group("Header Files\\Detail" FILES ${LOCAL_HEADERS}) \ No newline at end of file diff --git a/ReflectionTemplateLib/detail/inc/CallReflector.h b/ReflectionTemplateLib/rtl/detail/inc/CallReflector.h similarity index 62% rename from ReflectionTemplateLib/detail/inc/CallReflector.h rename to ReflectionTemplateLib/rtl/detail/inc/CallReflector.h index fad4ecd6..98f77596 100644 --- a/ReflectionTemplateLib/detail/inc/CallReflector.h +++ b/ReflectionTemplateLib/rtl/detail/inc/CallReflector.h @@ -13,7 +13,8 @@ #include #include "RObject.h" -#include "Constants.h" +#include "rtl_constants.h" +#include "FunctorId.h" namespace rtl::detail { @@ -30,10 +31,10 @@ namespace rtl::detail { * gets the lambda vector from '_derivedType' and calls the lambda at given index with '_args'. * this 'forwardCall' is for calling lambda containing non-member-function and static-member-function functors. */ template - FORCE_INLINE static Return forwardCall(std::size_t pFunctorIndex, _params&&..._args) + ForceInline static Return forwardCall(const detail::FunctorId& pFunctorId, _params&&..._args) { - //'getFunctors()' must be implemented by _derivedType (FunctorContainer). - return _derivedType::getFunctors()[pFunctorIndex](std::forward<_params>(_args)...); + //'getOverloads()' must be implemented by _derivedType (FunctorContainer). + return _derivedType::getOverloads()[pFunctorId.m_lambdaIndex](pFunctorId, std::forward<_params>(_args)...); } @@ -42,10 +43,18 @@ namespace rtl::detail { * gets the lambda vector from '_derivedType' and calls the lambda at given index with '_args'. * this 'forwardCall' is for calling lambda containing constructors. */ template - FORCE_INLINE static Return forwardCall(std::size_t pFunctorIndex, rtl::alloc pAllocType, std::size_t pClonerIndex, _params&&..._args) + ForceInline static Return forwardCall(const detail::FunctorId& pFunctorId, rtl::alloc pAllocType, const detail::FunctorId& pClonerId, _params&&..._args) { - //'getFunctors()' must be implemented by _derivedType (FunctorContainer). - return _derivedType::getFunctors()[pFunctorIndex](pAllocType, pClonerIndex, std::forward<_params>(_args)...); + //'getOverloads()' must be implemented by _derivedType (FunctorContainer). + return _derivedType::getOverloads()[pFunctorId.m_lambdaIndex](pFunctorId, pAllocType, pClonerId, std::forward<_params>(_args)...); + } + + + template + ForceInline static Return forwardCall(const detail::FunctorId& pFunctorId, const RObject& pSrcObj, rtl::alloc pAllocType) + { + //'getOverloads()' must be implemented by _derivedType (FunctorContainer). + return _derivedType::getOverloads()[pFunctorId.m_lambdaIndex](pFunctorId, pSrcObj, pAllocType); } @@ -54,10 +63,10 @@ namespace rtl::detail { * gets the lambda vector from '_derivedType' and calls the lambda at given index with '_args'. * this 'forwardCall' is for calling lambda containing member-function functors. */ template - FORCE_INLINE static Return forwardCall(const rtl::RObject& pTarget, std::size_t pFunctorIndex, _params&&..._args) + ForceInline static Return forwardCall(const detail::FunctorId& pFunctorId, const rtl::RObject& pTarget, _params&&..._args) { //'getMethodFunctors()' is implemented by _derivedType (MethodContainer) - return _derivedType::getMethodFunctors()[pFunctorIndex](pTarget, std::forward<_params>(_args)...); + return _derivedType::getMethodFunctors()[pFunctorId.m_lambdaIndex](pFunctorId, pTarget, std::forward<_params>(_args)...); } }; } \ No newline at end of file diff --git a/ReflectionTemplateLib/common/ConversionUtils.h b/ReflectionTemplateLib/rtl/detail/inc/ConversionUtils.h similarity index 100% rename from ReflectionTemplateLib/common/ConversionUtils.h rename to ReflectionTemplateLib/rtl/detail/inc/ConversionUtils.h diff --git a/ReflectionTemplateLib/detail/inc/CxxReflection.h b/ReflectionTemplateLib/rtl/detail/inc/CxxReflection.h similarity index 100% rename from ReflectionTemplateLib/detail/inc/CxxReflection.h rename to ReflectionTemplateLib/rtl/detail/inc/CxxReflection.h diff --git a/ReflectionTemplateLib/rtl/detail/inc/FunctionCaller.h b/ReflectionTemplateLib/rtl/detail/inc/FunctionCaller.h new file mode 100644 index 00000000..ee501b33 --- /dev/null +++ b/ReflectionTemplateLib/rtl/detail/inc/FunctionCaller.h @@ -0,0 +1,75 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "type_meta.h" +#include "rtl_forward_decls.h" + +namespace rtl::detail +{ + template + struct ErasedCaller + { + const Function& m_function; + + template + rtl::Return call(_args&&...) const noexcept; + + template requires (is_binding_v == false) + constexpr rtl::Return operator()(_args&&...params) const noexcept + { + return { error::InvalidCaller, RObject{} }; + } + + template requires (is_binding_v == true) + constexpr rtl::Return operator()(_args&&...params) const noexcept + { + return { error::SignatureMismatch, RObject{} }; + } + }; +} + + +namespace rtl::detail +{ + template + struct HopFunction + { + rtl::type_meta m_argsTfnMeta; + + std::vector m_overloadsFnMeta = {}; + + void initHopper(function& pFn) const; + + template requires (member_kind == member::None && std::is_same_v<_returnType, rtl::Return>) + constexpr function returnT() const; + + template requires (member_kind == member::None && !std::is_same_v<_returnType, rtl::Return>) + constexpr const function<_returnType(_signature...)> returnT() const; + + template requires (member_kind == member::Static && std::is_same_v<_returnType, rtl::Return>) + constexpr const static_method returnT() const; + + template requires (member_kind == member::Static && !std::is_same_v<_returnType, rtl::Return>) + constexpr const static_method<_returnType(_signature...)> returnT() const; + }; + + + template + struct Hopper + { + const std::vector& m_functorsMeta; + + template + constexpr const HopFunction argsT() const; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/detail/inc/FunctionCaller.hpp b/ReflectionTemplateLib/rtl/detail/inc/FunctionCaller.hpp new file mode 100644 index 00000000..4871ca01 --- /dev/null +++ b/ReflectionTemplateLib/rtl/detail/inc/FunctionCaller.hpp @@ -0,0 +1,194 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "RObject.h" +#include "Function.h" +#include "FunctionCaller.h" +#include "FunctorContainer.h" + +#include "erasure_base.h" +#include "rtl_function_erased_return.h" + +namespace rtl::detail +{ + template + template + ForceInline Return ErasedCaller::call(_args&&...params) const noexcept + { + using Container = std::conditional_t...>, + FunctorContainer<_signature...>>; + + const detail::FunctorId* functorId = m_function.hasFunctorId(Container::getContainerId()); + if (functorId != nullptr) [[likely]] { + return Container::template forwardCall<_args...>(*functorId, std::forward<_args>(params)...); + } + return { error::SignatureMismatch, RObject{} }; + } +} + + +namespace rtl::detail +{ + template + template requires (member_kind == member::None && std::is_same_v) + inline constexpr function HopFunction::returnT() const + { + function...)> erasedFn; + initHopper(erasedFn); + return erasedFn; + } + + + template + template requires (member_kind == member::Static && std::is_same_v) + inline constexpr const static_method HopFunction::returnT() const + { + static_method...)> erasedFn; + initHopper(erasedFn); + return erasedFn; + } + + template + template requires (member_kind == member::Static && !std::is_same_v) + inline constexpr const static_method HopFunction::returnT() const + { + static_method fn; + if (!m_argsTfnMeta.is_empty()) + { + if (m_argsTfnMeta.get_member_kind() != member::Static) { + fn.set_init_error(error::InvalidNonStaticMethodCaller); + } + else if (m_argsTfnMeta.get_member_kind() == member::Static) { + + const auto retId = traits::uid::value; + return m_argsTfnMeta.get_lambda() + .template to_function() + .template get_hopper(retId) + .f_ptr(); + } + } + return fn; + } + + + template + template requires (member_kind == member::None && !std::is_same_v) + inline constexpr const function HopFunction::returnT() const + { + function fn; + if (!m_argsTfnMeta.is_empty()) + { + if (m_argsTfnMeta.get_member_kind() == member::Static) { + fn.set_init_error(error::InvalidStaticMethodCaller); + } + else if (m_argsTfnMeta.get_member_kind() == member::None) { + + const auto retId = traits::uid::value; + return m_argsTfnMeta.get_lambda() + .template to_function() + .template get_hopper(retId); + } + } + return fn; + } + + + template + inline void HopFunction::initHopper(function& pHopFn) const + { + bool isReturnTvoid = false; + for (auto& fnMeta : m_overloadsFnMeta) + { + if (fnMeta.is_empty()) + { + pHopFn.get_vhop().push_back(nullptr); + pHopFn.get_rhop().push_back(nullptr); + pHopFn.get_overloads().push_back(nullptr); + continue; + } + + if constexpr (member_kind == member::Static) { + if (fnMeta.get_member_kind() != member::Static) { + pHopFn.set_init_error(error::InvalidNonStaticMethodCaller); + return; + } + } + else if constexpr (member_kind == member::None) { + if (fnMeta.get_member_kind() == member::Static) { + pHopFn.set_init_error(error::InvalidStaticMethodCaller); + return; + } + } + + auto& erasedRetFn = fnMeta.get_erasure_base() + .template to_erased_return...>(); + if (fnMeta.is_void()) { + isReturnTvoid = true; + pHopFn.get_vhop().push_back(erasedRetFn.get_void_hopper()); + } + else { + pHopFn.get_rhop().push_back(erasedRetFn.get_return_hopper()); + } + pHopFn.get_overloads().push_back(&fnMeta.get_lambda()); + pHopFn.set_init_error(error::None); + } + if (isReturnTvoid) { + pHopFn.get_rhop().clear(); + } + else { + pHopFn.get_vhop().clear(); + } + } + + + template + template + inline constexpr const HopFunction Hopper::argsT() const + { + auto strictArgsId = traits::uid>::value; + auto normalArgsId = traits::uid>::value; + + rtl::type_meta argsTfnMeta; + //initializing pos '0' with empty 'type_meta'. + std::vector overloadsFnMeta = { rtl::type_meta() }; + + for (auto& fnMeta : m_functorsMeta) + { + if (argsTfnMeta.is_empty() && strictArgsId == fnMeta.get_strict_args_id()) { + argsTfnMeta = fnMeta; + } + if (normalArgsId == fnMeta.get_normal_args_id()) + { + if (normalArgsId == fnMeta.get_strict_args_id()) { + // same normal & strict ids, means no refs exists in target function's signature + // target's function signature is call by value, always at pos '0'. + // if doesn't exists, this pos is occupied by an empty 'type_meta'. + overloadsFnMeta[0] = fnMeta; + } + else if (!fnMeta.is_any_arg_ncref()) { + // its a const-ref-overload with no non-const-ref in signature, added from pos '1' onwards. + overloadsFnMeta.push_back(fnMeta); + } + } + } + + for (auto& fnMeta : m_functorsMeta) { + if (normalArgsId == fnMeta.get_normal_args_id() && fnMeta.is_any_arg_ncref()) { + // any remaining overload, const/non-const ref added from pos '1' onwards. + overloadsFnMeta.push_back(fnMeta); + } + } + return { argsTfnMeta, overloadsFnMeta }; + } +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/detail/inc/FunctorId.h b/ReflectionTemplateLib/rtl/detail/inc/FunctorId.h new file mode 100644 index 00000000..5b1dbb0b --- /dev/null +++ b/ReflectionTemplateLib/rtl/detail/inc/FunctorId.h @@ -0,0 +1,91 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "rtl_constants.h" +#include "rtl_forward_decls.h" + +namespace rtl::detail +{ +/* @class: FunctorId + * 'FunctorId' object is generated for every functor (member/non-member function pointer) registered. + * acts as a hash-key to lookup a particular functor in the functor-table. + * first, using 'm_containerId', the functor-table container is found. + * once table is found, the functor is accessed at index 'm_index', (never fails, noexcept) + * 'FunctorId' generated for a each functor is unique, even for overloaded functions. + * multiple registartion of same functor will generate same duplicate 'FunctorId'. +*/ struct FunctorId + { + //index of the functor in the functor-table. + std::size_t m_lambdaIndex; + + //return type-id of the functor registered. + std::size_t m_returnId; + + //if functor is a member-function, type id of class/struct it belongs to. + std::size_t m_recordId; + + //containerId of the functor-table. + std::size_t m_containerId; + + //signature of functor as string. platform dependent, may not be very much readable format. + std::string m_signature; + + const dispatch::lambda_base* m_lambda = nullptr; + + GETTER(std::size_t, LambdaIndex, m_lambdaIndex) + GETTER(std::size_t, ReturnId, m_returnId); + GETTER(std::size_t, RecordId, m_recordId); + GETTER(std::size_t, SignatureId, m_containerId) + GETTER_CREF(std::string, SignatureStr, m_signature) + GETTER_CREF(dispatch::lambda_base, _lambda, (*m_lambda)) + + /* @method: getHashCode() + @return: std::size_t (a unique hash-code for a functor) + * 'm_containerId' will be same for functors(non-member) with same signatures. + * for member functions, a functor will have three atrributes + - signature + - whether it is const or non-const + - class/struct type + 'm_containerId' will be same for functors with same above attributes. + * every functor will have a distinct index in the functor-wrapped-lambda-table. + * so, combination of m_containerId & m_index is unique for every functor. + */ std::size_t getHashCode() const + { + return std::stoull(std::to_string(m_containerId) + + std::to_string(m_lambdaIndex) + + std::to_string(m_recordId) + + std::to_string(m_returnId)); + } + + const bool operator==(const FunctorId& pOther) const + { + return (m_returnId == pOther.m_returnId && + m_recordId == pOther.m_recordId && + m_containerId == pOther.m_containerId && + m_lambdaIndex == pOther.m_lambdaIndex && + m_signature == pOther.m_signature); + } + + template + using lambda_ft = dispatch::lambda_function<_signature...>; + + template + using lambda_mt = dispatch::lambda_method; + + template + constexpr const lambda_ft* get_lambda_function(std::size_t p_argsId = 0) const; + + template + constexpr const lambda_mt* get_lambda_method(std::size_t p_recordId = 0, std::size_t p_argsId = 0) const; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/detail/inc/FunctorId.hpp b/ReflectionTemplateLib/rtl/detail/inc/FunctorId.hpp new file mode 100644 index 00000000..5d81b100 --- /dev/null +++ b/ReflectionTemplateLib/rtl/detail/inc/FunctorId.hpp @@ -0,0 +1,32 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "FunctorId.h" + +#include "lambda_method.h" +#include "lambda_function.h" + +namespace rtl::detail +{ + template + inline constexpr const FunctorId::lambda_ft* FunctorId::get_lambda_function(std::size_t p_argsId) const + { + return m_lambda->to_function(p_argsId); + } + + template + inline constexpr const FunctorId::lambda_mt* FunctorId::get_lambda_method(std::size_t p_recordId, std::size_t p_argsId) const + { + return m_lambda->to_method(p_recordId, p_argsId); + } +} \ No newline at end of file diff --git a/ReflectionTemplateLib/detail/inc/MethodInvoker.h b/ReflectionTemplateLib/rtl/detail/inc/MethodInvoker.h similarity index 55% rename from ReflectionTemplateLib/detail/inc/MethodInvoker.h rename to ReflectionTemplateLib/rtl/detail/inc/MethodInvoker.h index 198cf761..b86d9766 100644 --- a/ReflectionTemplateLib/detail/inc/MethodInvoker.h +++ b/ReflectionTemplateLib/rtl/detail/inc/MethodInvoker.h @@ -11,12 +11,34 @@ #pragma once -namespace rtl { +#include "rtl_typeid.h" +#include "rtl_forward_decls.h" +#include "type_meta.h" + +namespace rtl::detail +{ + template + struct ErasedInvoker + { + const Method& m_method; + + const _recordType& m_target; - //forward decls - class Method; + template requires (std::is_same_v, RObject> == false) + constexpr Return operator()(_args&&...params) const noexcept + { + return { error::InvalidCaller, RObject{} }; + } + + template requires (std::is_same_v, RObject> == true) + constexpr Return operator()(_args&&...params) const noexcept + { + return { error::InvalidCaller, RObject{} }; + } + }; } + namespace rtl::detail { template @@ -35,8 +57,6 @@ namespace rtl::detail { static Return invoke(const Method& pMethod, const RObject& pTarget, _args&&...); }; - public: - template Return call(_args&&...) const noexcept; @@ -44,8 +64,6 @@ namespace rtl::detail { constexpr Return operator()(_args&&...params) const noexcept { return call(std::forward<_args>(params)...); } - - friend Method; }; @@ -65,8 +83,6 @@ namespace rtl::detail { static Return invoke(const Method& pMethod, const RObject& pTarget, _args&&...); }; - public: - template Return call(_args&&...) const noexcept; @@ -74,7 +90,35 @@ namespace rtl::detail { constexpr Return operator()(_args&&...params) const noexcept { return call(std::forward<_args>(params)...); } + }; +} + + +namespace rtl::detail +{ + template + struct HopMethod + { + rtl::type_meta m_argsTfnMeta; + + std::vector m_overloadsFnMeta = {}; + + template requires (!traits::type_aware_v) + void initHopper(method& pMth) const; + + template requires (traits::type_aware_v) + constexpr const method returnT() const; + + template requires (!traits::type_aware_v) + constexpr const method returnT() const; + }; + + template + struct Hopper + { + const std::vector& m_functorsMeta; - friend Method; + template + constexpr HopMethod argsT() const; }; } \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/detail/inc/MethodInvoker.hpp b/ReflectionTemplateLib/rtl/detail/inc/MethodInvoker.hpp new file mode 100644 index 00000000..ed22e853 --- /dev/null +++ b/ReflectionTemplateLib/rtl/detail/inc/MethodInvoker.hpp @@ -0,0 +1,294 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "Method.h" +#include "RObject.h" +#include "MethodInvoker.h" +#include "MethodContainer.h" +#include "erasure_base.h" + + +#include "erasure_base.hpp" +#include "rtl_method_erased.h" +#include "rtl_method_erased_target.h" +#include "rtl_method_erased_return.h" + +namespace rtl::detail +{ +/* @method: call() + @params: params... (corresponding to functor associated with 'm_method') + @return: RObject, indicating success of the reflected call. + * invokes non-static-member-function functor associated with 'm_method' on object 'm_target'. +*/ template + template + ForceInline Return DefaultInvoker<_signature...>::call(_args&& ...params) const noexcept + { + //Only static-member-functions have Qualifier- 'member::None' + if (m_method->getQualifier() == member::None) [[unlikely]] { + return static_cast(*m_method).bind().call(std::forward<_args>(params)...); + } + else if (m_target->isEmpty()) [[unlikely]] { + //if the target is empty. + return { error::EmptyRObject, RObject{} }; + } + else if (m_target->getTypeId() != m_method->getRecordTypeId()) [[unlikely]] { + //if the m_target's type-id & type-id of the 'class/struct' owner of the associated functor(m_method's) do not match. + return { error::TargetMismatch, RObject{} }; + } + else [[likely]] + { + if constexpr (sizeof...(_signature) == 0) { + // executes when bind doesn't have any explicit signature types specified. (e.g. perfect-forwaring) + return Invoker...>::invoke(*m_method, *m_target, std::forward<_args>(params)...); + } + else { + return Invoker<_signature...>::invoke(*m_method, *m_target, std::forward<_args>(params)...); + } + } + } + + + // Invoker struct's static method definition + template + template + template + ForceInline Return + DefaultInvoker<_signature...>::Invoker<_invokSignature...>::invoke(const Method& pMethod, + const RObject& pTarget, + _args&&... params) + { + using containerConst = detail::MethodContainer; + const FunctorId* constFunctorId = pMethod.hasFunctorId(containerConst::getContainerId()); + + if (constFunctorId != nullptr) [[likely]] + { + return containerConst::template forwardCall<_args...>(*constFunctorId, pTarget, std::forward<_args>(params)...); + } + else [[unlikely]] + { + using containerNonConst = detail::MethodContainer; + const FunctorId* functorId = pMethod.hasFunctorId(containerNonConst::getContainerId()); + + if (functorId != nullptr) + { + if (!pTarget.isConstCastSafe()) { + return { error::ConstOverloadMissing, RObject{} }; + } + return containerNonConst::template forwardCall<_args...>(*functorId, pTarget, std::forward<_args>(params)...); + } + } + return { error::SignatureMismatch, RObject{} }; + } +} + + +namespace rtl::detail +{ +/* @method: call() + @params: params... (corresponding to functor associated with 'm_method') + @return: RObject, indicating success of the reflected call. + * invokes non-static-member-function functor associated with 'm_method' on object 'm_target'. +*/ template + template + ForceInline Return NonConstInvoker<_signature...>::call(_args&& ...params) const noexcept + { + if (m_method->getQualifier() == member::None) [[unlikely]] { + return static_cast(*m_method).bind().call(std::forward<_args>(params)...); + } + else if (m_target->isEmpty()) [[unlikely]] { + //if the target is empty. + return { error::EmptyRObject, RObject{} }; + } + else if (m_target->getTypeId() != m_method->getRecordTypeId()) [[unlikely]] { + //if the m_target's type-id & type-id of the 'class/struct' owner of the associated functor(m_method's) do not match. + return { error::TargetMismatch, RObject{} }; + } + else [[likely]] + { + if constexpr (sizeof...(_signature) == 0) { + return Invoker...>::invoke(*m_method, *m_target, std::forward<_args>(params)...); + } + else { + return Invoker<_signature...>::invoke(*m_method, *m_target, std::forward<_args>(params)...); + } + } + } + + + // Invoker struct's static method definition + template + template + template + ForceInline Return + NonConstInvoker<_signature...>::Invoker<_invokSignature...>::invoke(const Method& pMethod, + const RObject& pTarget, + _args&&... params) + { + using container0 = detail::MethodContainer; + const FunctorId* functorId = pMethod.hasFunctorId(container0::getContainerId()); + + if (functorId != nullptr) [[likely]] { + return container0::template forwardCall<_args...>(*functorId, pTarget, std::forward<_args>(params)...); + } + else + { + // check if the const-overload method is present. + using container2 = detail::MethodContainer; + std::size_t index = pMethod.hasSignatureId(container2::getContainerId()); + if (index != rtl::index_none) { + // So, const-overload is present and non-const overload is not registered or doesn't exists. + return { error::NonConstOverloadMissing, RObject{} }; + } + // else the signature might be wrong. + return { error::SignatureMismatch, RObject{} }; + } + } +} + + +namespace rtl::detail +{ + template + template requires (!traits::type_aware_v) + inline constexpr const method HopMethod::returnT() const + { + method...)> erasedMth; + initHopper(erasedMth); + return erasedMth; + } + + + template + template requires (traits::type_aware_v) + inline constexpr const method HopMethod::returnT() const + { + method mth; + if (!m_argsTfnMeta.is_empty()) + { + if (m_argsTfnMeta.get_member_kind() == member::Static) { + mth.set_init_error(error::InvalidStaticMethodCaller); + } + else { + + const auto retId = traits::uid::value; + return m_argsTfnMeta.get_lambda() + .template to_method() + .template get_hopper(retId); + } + } + return mth; + } + + + template + template + inline constexpr HopMethod Hopper::argsT() const + { + auto recordId = traits::uid::value; + auto strictArgsId = traits::uid>::value; + auto normalArgsId = traits::uid>::value; + + type_meta argsTfnMeta; + //initializing pos '0' with empty 'type_meta'. + std::vector overloadsFnMeta = { type_meta() }; + + for (auto& fnMeta : m_functorsMeta) + { + if constexpr (!std::is_same_v) + { + if (recordId != fnMeta.get_record_id()) { + return { argsTfnMeta, overloadsFnMeta }; + } + } + + if (argsTfnMeta.is_empty() && strictArgsId == fnMeta.get_strict_args_id()) { + argsTfnMeta = fnMeta; + } + if (normalArgsId == fnMeta.get_normal_args_id()) + { + if (normalArgsId == fnMeta.get_strict_args_id()) { + // same normal & strict ids, means no refs exists in target function's signature + // target's function signature is call by value, always at pos '0'. + // if doesn't exists, this pos is occupied by an empty 'type_meta'. + overloadsFnMeta[0] = fnMeta; + } + else if (!fnMeta.is_any_arg_ncref()) { + // its a const-ref-overload with no non-const-ref in signature, added from pos '1' onwards. + overloadsFnMeta.push_back(fnMeta); + } + } + } + + for (auto& fnMeta : m_functorsMeta) { + if (recordId == fnMeta.get_record_id() && + normalArgsId == fnMeta.get_normal_args_id() && fnMeta.is_any_arg_ncref()) { + overloadsFnMeta.push_back(fnMeta); + } + } + return { argsTfnMeta, overloadsFnMeta }; + } + + + template + template requires (!traits::type_aware_v) + inline void HopMethod::initHopper(method& pMth) const + { + bool isReturnTvoid = false; + for (auto& fnMeta : m_overloadsFnMeta) + { + if (fnMeta.is_empty()) + { + pMth.get_vhop().push_back(nullptr); + pMth.get_rhop().push_back(nullptr); + pMth.get_overloads().push_back(nullptr); + continue; + } + + if (fnMeta.get_member_kind() == member::Static) { + pMth.set_init_error(error::InvalidStaticMethodCaller); + return; + } + + auto& erasedFn = [&]() -> decltype(auto) { + if constexpr (traits::type_erased_v) { + return fnMeta.get_erasure_base() + .template to_erased_record...>(); + } + else if constexpr (traits::target_erased_v) { + return fnMeta.get_erasure_base() + .template to_erased_target_aware_return...>(); + } + else if constexpr (traits::return_erased_v) { + return fnMeta.get_erasure_base() + .template to_erased_return_aware_target...>(); + } + }(); + + if (fnMeta.is_void()) { + isReturnTvoid = true; + pMth.get_vhop().push_back(erasedFn.get_void_hopper()); + } + else { + pMth.get_rhop().push_back(erasedFn.get_return_hopper()); + } + pMth.get_overloads().push_back(&fnMeta.get_lambda()); + pMth.set_init_error(error::None); + } + if (isReturnTvoid) { + pMth.get_rhop().clear(); + } + else { + pMth.get_vhop().clear(); + } + } +} \ No newline at end of file diff --git a/ReflectionTemplateLib/detail/inc/RObjExtracter.h b/ReflectionTemplateLib/rtl/detail/inc/RObjExtracter.h similarity index 92% rename from ReflectionTemplateLib/detail/inc/RObjExtracter.h rename to ReflectionTemplateLib/rtl/detail/inc/RObjExtracter.h index 8f1c11ef..14ab3623 100644 --- a/ReflectionTemplateLib/detail/inc/RObjExtracter.h +++ b/ReflectionTemplateLib/rtl/detail/inc/RObjExtracter.h @@ -22,7 +22,7 @@ namespace rtl::detail const RObject* m_rObj; template - FORCE_INLINE static const T* getPointer(const std::any& pObject, const EntityKind pEntityKind) noexcept + ForceInline static const T* getPointer(const std::any& pObject, const EntityKind pEntityKind) noexcept { switch (pEntityKind) { @@ -39,7 +39,7 @@ namespace rtl::detail template - FORCE_INLINE const T* getPointer() const noexcept + ForceInline const T* getPointer() const noexcept { switch (m_rObj->m_objectId.m_containsAs) { @@ -59,7 +59,7 @@ namespace rtl::detail template = 0> - FORCE_INLINE auto getWrapper() const noexcept -> const RObjectUPtr::value_type>* + ForceInline auto getWrapper() const noexcept -> const RObjectUPtr::value_type>* { if (m_rObj->m_objectId.m_wrapperType == detail::Wrapper::Unique) { @@ -83,7 +83,7 @@ namespace rtl::detail template = 0> - FORCE_INLINE const T* getWrapper() const noexcept + ForceInline const T* getWrapper() const noexcept { if (m_rObj->m_objectId.m_wrapperType == detail::Wrapper::Shared) { @@ -106,7 +106,7 @@ namespace rtl::detail template - FORCE_INLINE const T* getFromWrapper() const noexcept + ForceInline const T* getFromWrapper() const noexcept { if constexpr (std::is_destructible_v) { diff --git a/ReflectionTemplateLib/detail/inc/RObjectId.h b/ReflectionTemplateLib/rtl/detail/inc/RObjectId.h similarity index 81% rename from ReflectionTemplateLib/detail/inc/RObjectId.h rename to ReflectionTemplateLib/rtl/detail/inc/RObjectId.h index 5455ca9f..3dd82196 100644 --- a/ReflectionTemplateLib/detail/inc/RObjectId.h +++ b/ReflectionTemplateLib/rtl/detail/inc/RObjectId.h @@ -12,12 +12,10 @@ #pragma once #include -#include -#include "ReflectCast.h" +#include -namespace rtl { - class RObject; -} +#include "ReflectCast.h" +#include "FunctorId.h" namespace rtl::detail { @@ -27,18 +25,19 @@ namespace rtl::detail bool m_isConstCastSafe; std::size_t m_typeId; - std::size_t m_clonerIndex; std::size_t m_wrapperTypeId; alloc m_allocatedOn; Wrapper m_wrapperType; EntityKind m_containsAs; + std::optional m_clonerId; + GETTER(std::size_t, TypeId, m_typeId) GETTER(EntityKind, ContainedAs, m_containsAs) template - FORCE_INLINE static constexpr EntityKind getEntityKind() noexcept + ForceInline static constexpr EntityKind getEntityKind() noexcept { using W = traits::std_wrapper>; using _T = traits::raw_t>; @@ -58,7 +57,7 @@ namespace rtl::detail template - FORCE_INLINE static RObjectId create(std::size_t pClonerIndex, bool pIsConstCastSafe) noexcept + ForceInline static RObjectId create(bool pIsConstCastSafe, std::optional pClonerId = std::nullopt) noexcept { // extract wrapper info. using _W = traits::std_wrapper>; @@ -68,8 +67,19 @@ namespace rtl::detail const std::size_t wrapperId = _W::id(); const std::size_t typeId = rtl::detail::TypeId<_T>::get(); + constexpr bool isWrappingConst = (_W::type != Wrapper::None && traits::is_const_v); - return RObjectId{ isWrappingConst, pIsConstCastSafe, typeId, pClonerIndex, wrapperId, _allocOn, _W::type, entityKind }; + return RObjectId { + + isWrappingConst, + pIsConstCastSafe, + typeId, + wrapperId, + _allocOn, + _W::type, + entityKind, + pClonerId + }; } }; } \ No newline at end of file diff --git a/ReflectionTemplateLib/detail/inc/RObjectUPtr.h b/ReflectionTemplateLib/rtl/detail/inc/RObjectUPtr.h similarity index 92% rename from ReflectionTemplateLib/detail/inc/RObjectUPtr.h rename to ReflectionTemplateLib/rtl/detail/inc/RObjectUPtr.h index 67137208..4fe7c442 100644 --- a/ReflectionTemplateLib/detail/inc/RObjectUPtr.h +++ b/ReflectionTemplateLib/rtl/detail/inc/RObjectUPtr.h @@ -13,7 +13,6 @@ #include #include #include -#include #include "RObject.h" @@ -70,13 +69,13 @@ namespace rtl::detail // Construct directly from std::unique_ptr, tracking RTL-owned heap allocations. RObjectUPtr(std::unique_ptr&& pUniquePtr) : m_uniquePtr(std::move(pUniquePtr)) { - RObject::getInstanceCounter().fetch_add(1, std::memory_order_relaxed); + RObject::getInstanceCounter()++;//.fetch_add(1, std::memory_order_relaxed); } // Destructor: decrements allocation count if we still own the object. ~RObjectUPtr() { if (m_uniquePtr) { - RObject::getInstanceCounter().fetch_sub(1, std::memory_order_relaxed); + RObject::getInstanceCounter()--;//.fetch_sub(1, std::memory_order_relaxed); } } @@ -87,7 +86,7 @@ namespace rtl::detail std::unique_ptr release() const { if (m_uniquePtr) { - RObject::getInstanceCounter().fetch_sub(1, std::memory_order_relaxed); + RObject::getInstanceCounter()--;//.fetch_sub(1, std::memory_order_relaxed); return std::move(m_uniquePtr); } return nullptr; diff --git a/ReflectionTemplateLib/detail/inc/ReflectCast.h b/ReflectionTemplateLib/rtl/detail/inc/ReflectCast.h similarity index 83% rename from ReflectionTemplateLib/detail/inc/ReflectCast.h rename to ReflectionTemplateLib/rtl/detail/inc/ReflectCast.h index ae748ba8..726ad21b 100644 --- a/ReflectionTemplateLib/detail/inc/ReflectCast.h +++ b/ReflectionTemplateLib/rtl/detail/inc/ReflectCast.h @@ -16,11 +16,7 @@ #include #include "rtl_traits.h" - -namespace rtl { - - class CxxMirror; -} +#include "rtl_forward_decls.h" namespace rtl::detail { @@ -35,7 +31,7 @@ namespace rtl::detail template class ReflectCast { - static std::vector>& conversions() { + ForceInline static std::vector>& conversions() { static std::vector> converters; return converters; } @@ -44,7 +40,7 @@ namespace rtl::detail template static void pushConversion(); - static const std::vector>& getConversions() { + ForceInline static const std::vector>& getConversions() { return conversions(); } }; diff --git a/ReflectionTemplateLib/detail/inc/ReflectCast.hpp b/ReflectionTemplateLib/rtl/detail/inc/ReflectCast.hpp similarity index 99% rename from ReflectionTemplateLib/detail/inc/ReflectCast.hpp rename to ReflectionTemplateLib/rtl/detail/inc/ReflectCast.hpp index 85b405aa..78e32745 100644 --- a/ReflectionTemplateLib/detail/inc/ReflectCast.hpp +++ b/ReflectionTemplateLib/rtl/detail/inc/ReflectCast.hpp @@ -11,7 +11,7 @@ #pragma once -#include "TypeId.h" +#include "rtl_typeid.h" #include "ReflectCast.h" #include "ConversionUtils.h" diff --git a/ReflectionTemplateLib/detail/inc/ReflectCastUtil.h b/ReflectionTemplateLib/rtl/detail/inc/ReflectCastUtil.h similarity index 100% rename from ReflectionTemplateLib/detail/inc/ReflectCastUtil.h rename to ReflectionTemplateLib/rtl/detail/inc/ReflectCastUtil.h diff --git a/ReflectionTemplateLib/rtl/detail/src/CMakeLists.txt b/ReflectionTemplateLib/rtl/detail/src/CMakeLists.txt new file mode 100644 index 00000000..668c6728 --- /dev/null +++ b/ReflectionTemplateLib/rtl/detail/src/CMakeLists.txt @@ -0,0 +1,11 @@ +# ReflectionTemplateLibrary-CPP/ReflectionTemplateLib/detail/src/CMakeLists.txt + +# All .cpp files in this folder (absolute paths) +set(LOCAL_SOURCES + "${CMAKE_CURRENT_SOURCE_DIR}/CxxReflection.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/ReflectCast.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/RObjectConverters_string.cpp" +) + +target_sources(ReflectionTemplateLib PRIVATE ${LOCAL_SOURCES}) +source_group("Source Files\\Detail" FILES ${LOCAL_SOURCES}) \ No newline at end of file diff --git a/ReflectionTemplateLib/detail/src/CxxReflection.cpp b/ReflectionTemplateLib/rtl/detail/src/CxxReflection.cpp similarity index 98% rename from ReflectionTemplateLib/detail/src/CxxReflection.cpp rename to ReflectionTemplateLib/rtl/detail/src/CxxReflection.cpp index 762974c7..48849bb5 100644 --- a/ReflectionTemplateLib/detail/src/CxxReflection.cpp +++ b/ReflectionTemplateLib/rtl/detail/src/CxxReflection.cpp @@ -12,7 +12,7 @@ #include #include -#include "TypeId.h" +#include "rtl_typeid.h" #include "Record.h" #include "Method.h" #include "CxxReflection.h" @@ -51,6 +51,7 @@ namespace rtl { else { const auto& function = itr->second; //if the function is already present, add its 'FunctorId' as overload. + // TODO: Make sure every overload has identical return type/id. function.addOverload(pFunction); } } @@ -73,6 +74,7 @@ namespace rtl { else { const auto& function = itr->second; //if the method is already present, add as overload. + // TODO: Make sure every overload has identical return type/id. function.addOverload(pFunction); } } diff --git a/ReflectionTemplateLib/detail/src/RObjectConverters_string.cpp b/ReflectionTemplateLib/rtl/detail/src/RObjectConverters_string.cpp similarity index 99% rename from ReflectionTemplateLib/detail/src/RObjectConverters_string.cpp rename to ReflectionTemplateLib/rtl/detail/src/RObjectConverters_string.cpp index 8e8363a3..67355763 100644 --- a/ReflectionTemplateLib/detail/src/RObjectConverters_string.cpp +++ b/ReflectionTemplateLib/rtl/detail/src/RObjectConverters_string.cpp @@ -9,7 +9,7 @@ *************************************************************************/ -#include "TypeId.h" +#include "rtl_typeid.h" #include "ReflectCast.hpp" #include diff --git a/ReflectionTemplateLib/detail/src/ReflectCast.cpp b/ReflectionTemplateLib/rtl/detail/src/ReflectCast.cpp similarity index 100% rename from ReflectionTemplateLib/detail/src/ReflectCast.cpp rename to ReflectionTemplateLib/rtl/detail/src/ReflectCast.cpp diff --git a/ReflectionTemplateLib/rtl/dispatch/CMakeLists.txt b/ReflectionTemplateLib/rtl/dispatch/CMakeLists.txt new file mode 100644 index 00000000..86421840 --- /dev/null +++ b/ReflectionTemplateLib/rtl/dispatch/CMakeLists.txt @@ -0,0 +1,32 @@ +# ReflectionTemplateLibrary-CPP/ReflectionTemplateLib/dispatch/CMakeLists.txt + +# Collect headers in this folder (absolute paths) +set(LOCAL_HEADERS + + "${CMAKE_CURRENT_SOURCE_DIR}/functor.h" + + "${CMAKE_CURRENT_SOURCE_DIR}/method_ptr.h" + "${CMAKE_CURRENT_SOURCE_DIR}/function_ptr.h" + "${CMAKE_CURRENT_SOURCE_DIR}/constructor_ptr.h" + "${CMAKE_CURRENT_SOURCE_DIR}/method_ptr_const.h" + + "${CMAKE_CURRENT_SOURCE_DIR}/lambda_base.h" + "${CMAKE_CURRENT_SOURCE_DIR}/lambda_method.h" + "${CMAKE_CURRENT_SOURCE_DIR}/lambda_function.h" + + "${CMAKE_CURRENT_SOURCE_DIR}/rtl_function.h" + "${CMAKE_CURRENT_SOURCE_DIR}/rtl_function_erased_return.h" + + "${CMAKE_CURRENT_SOURCE_DIR}/rtl_method.h" + "${CMAKE_CURRENT_SOURCE_DIR}/rtl_method_erased.h" + "${CMAKE_CURRENT_SOURCE_DIR}/rtl_method_erased_return.h" + "${CMAKE_CURRENT_SOURCE_DIR}/rtl_method_erased_target.h" + + "${CMAKE_CURRENT_SOURCE_DIR}/rtl_method_const.h" + "${CMAKE_CURRENT_SOURCE_DIR}/rtl_method_erased_const.h" + "${CMAKE_CURRENT_SOURCE_DIR}/rtl_method_erased_return_const.h" + "${CMAKE_CURRENT_SOURCE_DIR}/rtl_method_erased_target_const.h" +) + +target_sources(ReflectionTemplateLib PRIVATE ${LOCAL_HEADERS}) +source_group("Header Files\\Dispatch" FILES ${LOCAL_HEADERS}) diff --git a/ReflectionTemplateLib/rtl/dispatch/constructor_ptr.h b/ReflectionTemplateLib/rtl/dispatch/constructor_ptr.h new file mode 100644 index 00000000..6df40fae --- /dev/null +++ b/ReflectionTemplateLib/rtl/dispatch/constructor_ptr.h @@ -0,0 +1,60 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "rtl_errors.h" +#include "RObjectBuilder.hpp" + +namespace rtl::dispatch +{ + template + struct constructor_ptr + { + template + static rtl::RObject create(args_t...params) + { + if constexpr (sizeof...(args_t) == 0 && !std::is_default_constructible_v) + { //default constructor, private or deleted. + return { error::TypeNotDefaultConstructible, RObject{} }; + } + else + { + if (pAllocType == alloc::Stack) { + + if constexpr (!std::is_copy_constructible_v) + { + return { + error::TypeNotCopyConstructible, RObject{} + }; + } + else + { + return { + error::None, + RObjectBuilder::template + build(record_t(std::forward<_signature>(params)...), pClonerId, true) + }; + } + } + else if (pAllocType == alloc::Heap) + { + return { + error::None, + RObjectBuilder::template + build(new record_t(std::forward<_signature>(params)...), pClonerId, true) + }; + } + } + return { error::EmptyRObject, RObject{} }; //dead code. compiler warning omitted. + } + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/dispatch/function_ptr.h b/ReflectionTemplateLib/rtl/dispatch/function_ptr.h new file mode 100644 index 00000000..e21895de --- /dev/null +++ b/ReflectionTemplateLib/rtl/dispatch/function_ptr.h @@ -0,0 +1,50 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "functor.h" + +namespace rtl::dispatch +{ + template + struct function_ptr: public functor + { + using functor_t = return_t(*)(signature_t...); + + constexpr auto f_ptr() const { + return m_functor; + } + + constexpr bool is_same(functor_t fptr) const { + return (fptr == m_functor); + } + + function_ptr(functor_t fptr, traits::uid_t p_record_uid, detail::member member_kind) :m_functor(fptr) + { + m_record_id = p_record_uid; + m_is_void = std::is_void_v; + m_return_id = traits::uid::value; + + m_member_kind = member_kind; + m_is_any_arg_ncref = (traits::is_nonconst_ref_v || ...); + m_normal_args_id = traits::uid>::value; + m_strict_args_id = traits::uid>::value; + + m_return_str = detail::TypeId::toString(); + m_signature_str = detail::TypeId::toString(); + } + + private: + + functor_t m_functor; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/dispatch/functor.h b/ReflectionTemplateLib/rtl/dispatch/functor.h new file mode 100644 index 00000000..b01c0fa8 --- /dev/null +++ b/ReflectionTemplateLib/rtl/dispatch/functor.h @@ -0,0 +1,74 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "rtl_traits.h" +#include "rtl_constants.h" +#include "rtl_forward_decls.h" + +namespace rtl::dispatch +{ + struct functor + { + constexpr bool is_void() const { + return m_is_void; + } + + protected: + + std::string m_record_str; + std::string m_return_str; + std::string m_signature_str; + + traits::uid_t m_record_id = traits::uid<>::none; + traits::uid_t m_return_id = traits::uid<>::none; + + traits::uid_t m_normal_args_id = traits::uid<>::none; + traits::uid_t m_strict_args_id = traits::uid<>::none; + + bool m_is_void = false; + bool m_is_any_arg_ncref = false; + std::vector m_args_type_ids = {}; + + detail::member m_member_kind = detail::member::None; + + private: + + constexpr void set_lambda(const dispatch::lambda_base* p_lambda) const { + m_lambda = p_lambda; + } + + constexpr void set_erasure(const dispatch::erasure_base* p_elambda) const { + m_erasure = p_elambda; + } + + mutable const dispatch::lambda_base* m_lambda = nullptr; + + mutable const dispatch::erasure_base* m_erasure = nullptr; + + friend rtl::type_meta; + + friend dispatch::lambda_base; + + template + friend struct dispatch::lambda_function; + + template + friend struct dispatch::lambda_method; + + template + friend struct cache::lambda_function; + + template + friend struct cache::lambda_method; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/dispatch/lambda_base.h b/ReflectionTemplateLib/rtl/dispatch/lambda_base.h new file mode 100644 index 00000000..ec3cc924 --- /dev/null +++ b/ReflectionTemplateLib/rtl/dispatch/lambda_base.h @@ -0,0 +1,77 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "rtl_traits.h" +#include "functor.h" +#include "erasure_base.h" + +namespace rtl::dispatch +{ + struct lambda_base + { + template + using function_t = lambda_function; + + template + constexpr const function_t& to_function() const + { + return static_cast&>(*this); + } + + template + constexpr const function_t* to_function(std::size_t p_argsId) const + { + if (p_argsId == 0 || p_argsId == m_functor.m_strict_args_id) [[likely]] + { + return static_cast*>(this); + } + else return nullptr; + } + + template + using method_t = lambda_method; + + template + constexpr const method_t& to_method() const + { + return static_cast&>(*this); + } + + template + constexpr const method_t* to_method(std::size_t p_recordId, std::size_t p_argsId) const + { + if (p_recordId == 0 || p_argsId ==0 || + (p_recordId == m_functor.m_record_id && p_argsId == m_functor.m_strict_args_id)) [[likely]] + { + return static_cast*>(this); + } + else return nullptr; + } + + GETTER_BOOL(_void, m_functor.m_is_void) + GETTER_BOOL(_any_arg_ncref, m_functor.m_is_any_arg_ncref) + + GETTER(traits::uid_t, _strict_sign_id, m_functor.m_strict_args_id) + GETTER(traits::uid_t, _normal_sign_id, m_functor.m_normal_args_id) + GETTER_CREF(detail::RObjectId, _return_id, m_erasure.m_return_id) + + lambda_base(const functor& p_functor, const erasure_base& p_erasure) noexcept + : m_functor(p_functor) + , m_erasure(p_erasure) + { } + + const functor& m_functor; + + const erasure_base& m_erasure; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/dispatch/lambda_function.h b/ReflectionTemplateLib/rtl/dispatch/lambda_function.h new file mode 100644 index 00000000..bc18ddf0 --- /dev/null +++ b/ReflectionTemplateLib/rtl/dispatch/lambda_function.h @@ -0,0 +1,47 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "lambda_base.h" +#include "rtl_function.h" +#include "function_ptr.h" + +namespace rtl::dispatch +{ + template + struct lambda_function: public lambda_base + { + template + using hopper_t = rtl::function; + + template + constexpr decltype(auto) get_functor(const std::size_t p_returnId = 0) const + { + return static_cast&>(m_functor).f_ptr(); + } + + template + constexpr const hopper_t get_hopper(const std::size_t p_returnId = 0) const + { + if (p_returnId == 0 || p_returnId == m_functor.m_return_id) [[likely]] + { + auto fptr = static_cast&>(m_functor).f_ptr(); + return hopper_t(fptr); + } + return hopper_t(); + } + + lambda_function(const functor& p_functor, const erasure_base& p_erasure) noexcept + : lambda_base(p_functor, p_erasure) + { } + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/dispatch/lambda_method.h b/ReflectionTemplateLib/rtl/dispatch/lambda_method.h new file mode 100644 index 00000000..e2325fe6 --- /dev/null +++ b/ReflectionTemplateLib/rtl/dispatch/lambda_method.h @@ -0,0 +1,65 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "lambda_base.h" + +#include "method_ptr.h" + +#include "rtl_method.h" +#include "rtl_method_const.h" + + +namespace rtl::dispatch +{ + template + struct lambda_method : public lambda_base + { + template + using hopper_t = rtl::method; + + template + constexpr decltype(auto) get_functor(std::size_t p_returnId = 0) const + { + return static_cast&>(m_functor).f_ptr(); + } + + template requires (!std::is_const_v) + constexpr const hopper_t get_hopper(std::size_t p_returnId = 0) const + { + if (p_returnId == 0 || p_returnId == m_functor.m_return_id) [[likely]] + { + auto fptr = static_cast&>(m_functor).f_ptr(); + return hopper_t(fptr); + } + return hopper_t(); + } + + template + using hopper_ct = rtl::method; + + template requires (std::is_const_v) + constexpr const hopper_ct get_hopper(std::size_t p_returnId = 0) const + { + if (p_returnId == 0 || p_returnId == m_functor.m_return_id) [[likely]] + { + auto fptr = static_cast&>(m_functor).f_ptr(); + return hopper_ct(fptr); + } + return hopper_ct(); + } + + lambda_method(const functor& p_functor, const erasure_base& p_erasure) noexcept + : lambda_base(p_functor, p_erasure) + { } + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/dispatch/method_ptr.h b/ReflectionTemplateLib/rtl/dispatch/method_ptr.h new file mode 100644 index 00000000..5bd763ea --- /dev/null +++ b/ReflectionTemplateLib/rtl/dispatch/method_ptr.h @@ -0,0 +1,54 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include + +#include "functor.h" + +namespace rtl::dispatch +{ + template + struct method_ptr : public functor + { + using functor_t = return_t(record_t::*)(signature_t...); + + constexpr auto f_ptr() const { + return m_functor; + } + + constexpr bool is_same(functor_t fptr) const { + return (fptr == m_functor); + } + + method_ptr(functor_t fptr) :m_functor(fptr) + { + m_member_kind = detail::member::NonConst; + + m_is_void = std::is_void_v; + m_return_id = traits::uid::value; + m_record_id = traits::uid::value; + + m_is_any_arg_ncref = (traits::is_nonconst_ref_v || ...); + m_normal_args_id = traits::uid>::value; + m_strict_args_id = traits::uid>::value; + + m_return_str = detail::TypeId::toString(); + m_record_str = detail::TypeId::toString(); + m_signature_str = detail::TypeId::toString(); + } + + private: + + const functor_t m_functor; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/dispatch/method_ptr_const.h b/ReflectionTemplateLib/rtl/dispatch/method_ptr_const.h new file mode 100644 index 00000000..416fd565 --- /dev/null +++ b/ReflectionTemplateLib/rtl/dispatch/method_ptr_const.h @@ -0,0 +1,54 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include + +#include "functor.h" + +namespace rtl::dispatch +{ + template + struct method_ptr : public functor + { + using functor_t = return_t(record_t::*)(signature_t...) const; + + constexpr auto f_ptr() const { + return m_functor; + } + + constexpr bool is_same(functor_t fptr) const { + return (fptr == m_functor); + } + + method_ptr(functor_t fptr) :m_functor(fptr) + { + m_member_kind = detail::member::Const; + + m_return_id = traits::uid::value; + m_is_void = (m_return_id == traits::uid::value); + m_record_id = traits::uid::value; + + m_is_any_arg_ncref = (traits::is_nonconst_ref_v || ...); + m_normal_args_id = traits::uid>::value; + m_strict_args_id = traits::uid>::value; + + m_return_str = detail::TypeId::toString(); + m_record_str = detail::TypeId::toString(); + m_signature_str = detail::TypeId::toString(); + } + + private: + + const functor_t m_functor; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/dispatch/rtl_function.h b/ReflectionTemplateLib/rtl/dispatch/rtl_function.h new file mode 100644 index 00000000..b536296f --- /dev/null +++ b/ReflectionTemplateLib/rtl/dispatch/rtl_function.h @@ -0,0 +1,88 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "rtl_traits.h" +#include "rtl_forward_decls.h" + +namespace rtl +{ + template + struct function + { + using fptr_t = return_t(*)(signature_t...); + + constexpr auto f_ptr() const { + return m_functor; + } + + constexpr operator bool() const { + return (m_functor != nullptr); + } + + template + [[nodiscard]] [[gnu::hot]] + constexpr decltype(auto) operator()(args_t&&...params) const noexcept + { + return (*m_functor)(std::forward(params)...); + } + + function(fptr_t p_functor) + : m_init_err(error::None) + , m_functor(p_functor) + { } + + function() = default; + function(function&&) = default; + function(const function&) = default; + + function& operator=(function&&) = default; + function& operator=(const function&) = default; + + GETTER(rtl::error, _init_error, m_init_err) + + protected: + + fptr_t m_functor = nullptr; + error m_init_err = error::InvalidCaller; + + void set_init_error(error p_err) { + m_init_err = p_err; + } + + template + friend struct detail::HopFunction; + }; +} + + +namespace rtl +{ + template + struct static_method : function + { + using base_t = function; + + static_method(base_t::fptr_t p_functor) : base_t(p_functor) + { } + + static_method() = default; + static_method(static_method&&) = default; + static_method(const static_method&) = default; + + static_method& operator=(static_method&&) = default; + static_method& operator=(const static_method&) = default; + + template + friend struct detail::HopFunction; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/dispatch/rtl_function_erased_return.h b/ReflectionTemplateLib/rtl/dispatch/rtl_function_erased_return.h new file mode 100644 index 00000000..939a9b41 --- /dev/null +++ b/ReflectionTemplateLib/rtl/dispatch/rtl_function_erased_return.h @@ -0,0 +1,156 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "rtl_traits.h" +#include "rtl_forward_decls.h" +#include "lambda_base.h" + +namespace rtl +{ + template + struct function + { + template requires (sizeof...(args_t) == sizeof...(signature_t)) + [[nodiscard]] [[gnu::hot]] [[gnu::flatten]] + constexpr Return operator()(args_t&&...params) const noexcept + { + if (!(*this)) [[unlikely]] { + return { m_init_err, RObject{} }; + } + + if (must_bind_refs()) [[unlikely]] { + return { error::ExplicitRefBindingRequired, RObject{} }; + } + + auto index = (m_lambdas[call_by::value] != nullptr ? call_by::value : call_by::cref); + if (m_lambdas[index]->is_void()) + { + m_vhop[index](*m_lambdas[index], std::forward(params)...); + return { error::None, RObject{} }; + } + else + { + return { error::None, + RObject{ m_rhop[index](*m_lambdas[index], std::forward(params)...), + m_lambdas.back()->get_return_id(), nullptr + } + }; + } + } + + template + struct perfect_fwd + { + const function& fn; + + template + [[nodiscard]] [[gnu::hot]] [[gnu::flatten]] + constexpr Return operator()(args_t&&...params) const noexcept + { + if (!fn) [[unlikely]] { + return { fn.m_init_err, RObject{} }; + } + + auto signature_id = traits::uid>::value; + for (int index = 0; index < fn.m_lambdas.size(); index++) + { + if (fn.m_lambdas[index] != nullptr) + { + if (signature_id == fn.m_lambdas[index]->get_strict_sign_id()) + { + if (fn.m_lambdas[index]->is_void()) + { + fn.m_vhop[index](*fn.m_lambdas[index], std::forward(params)...); + return { error::None, RObject{} }; + } + else + { + return { error::None, + RObject{ fn.m_rhop[index](*fn.m_lambdas[index], std::forward(params)...), + fn.m_lambdas.back()->get_return_id(), nullptr + } + }; + } + } + } + } + return { error::RefBindingMismatch, RObject{} }; + } + }; + + template + requires (std::is_same_v, std::tuple>) + constexpr const perfect_fwd bind() const noexcept { + return perfect_fwd{ *this }; + } + + constexpr operator bool() const noexcept { + return !(m_init_err != error::None || m_lambdas.empty() || + (m_lambdas.size() == 1 && m_lambdas[0] == nullptr)); + + } + + constexpr bool must_bind_refs() const noexcept { + return (m_lambdas[call_by::value] == nullptr && + (m_lambdas.size() > call_by::ncref || m_lambdas[call_by::cref]->is_any_arg_ncref())); + } + + enum call_by + { + value = 0, + cref = 1, //const ref. + ncref = 2 //non-const ref. + }; + + GETTER(rtl::error, _init_error, m_init_err) + + private: + + using lambda_vt = std::function; + + using lambda_rt = std::function; + + std::vector m_rhop = {}; + + std::vector m_vhop = {}; + + std::vector m_lambdas = {}; + + error m_init_err = error::InvalidCaller; + + void set_init_error(error p_err) { + m_init_err = p_err; + } + + GETTER_REF(std::vector, _rhop, m_rhop) + GETTER_REF(std::vector, _vhop, m_vhop) + GETTER_REF(std::vector, _overloads, m_lambdas) + + template + friend struct detail::HopFunction; + + static_assert((!std::is_reference_v && ...), + "rtl::function<...>: any type cannot be specified as reference here"); + }; +} + + +namespace rtl +{ + template + struct static_method : function + { + template + friend struct detail::HopFunction; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/dispatch/rtl_method.h b/ReflectionTemplateLib/rtl/dispatch/rtl_method.h new file mode 100644 index 00000000..506001bd --- /dev/null +++ b/ReflectionTemplateLib/rtl/dispatch/rtl_method.h @@ -0,0 +1,84 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "rtl_traits.h" +#include "rtl_forward_decls.h" + + +namespace rtl +{ + template + requires (!std::is_same_v && !std::is_same_v) + struct method + { + using fptr_t = return_t (record_t::*)(signature_t...); + + constexpr auto f_ptr() const { + return m_functor; + } + + constexpr operator bool() const { + return (m_functor != nullptr); + } + + struct invoker + { + fptr_t functor; + const record_t& target; + + template + requires (sizeof...(args_t) == sizeof...(signature_t)) + [[nodiscard]] [[gnu::hot]] + constexpr decltype(auto) operator()(args_t&&...params) const noexcept + { + return (const_cast(target).*functor)(std::forward(params)...); + } + }; + + [[gnu::hot]] + constexpr const invoker operator()(record_t& p_target) const noexcept { + return invoker{ m_functor, p_target }; + } + + [[gnu::hot]] + constexpr const invoker operator()(record_t&& p_target) const noexcept { + return invoker{ m_functor, p_target }; + } + + method(fptr_t p_functor) + : m_init_err(error::None) + , m_functor(p_functor) + { } + + method() = default; + method(method&&) = default; + method(const method&) = default; + + method& operator=(method&&) = default; + method& operator=(const method&) = default; + + GETTER(rtl::error, _init_error, m_init_err) + + private: + + fptr_t m_functor = nullptr; + error m_init_err = error::InvalidCaller; + + void set_init_error(error p_err) { + m_init_err = p_err; + } + + template + friend struct detail::HopMethod; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/dispatch/rtl_method_const.h b/ReflectionTemplateLib/rtl/dispatch/rtl_method_const.h new file mode 100644 index 00000000..4f5ac8c9 --- /dev/null +++ b/ReflectionTemplateLib/rtl/dispatch/rtl_method_const.h @@ -0,0 +1,79 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "rtl_traits.h" +#include "rtl_forward_decls.h" + + +namespace rtl +{ + template + requires (!std::is_same_v && !std::is_same_v) + struct method + { + using fptr_t = return_t(record_t::*)(signature_t...) const; + + constexpr auto f_ptr() const { + return m_functor; + } + + constexpr operator bool() const { + return (m_functor != nullptr); + } + + struct invoker + { + fptr_t functor; + const record_t& target; + + template + requires (sizeof...(args_t) == sizeof...(signature_t)) + [[nodiscard]] [[gnu::hot]] + constexpr decltype(auto) operator()(args_t&&...params) const noexcept + { + return (target.*functor)(std::forward(params)...); + } + }; + + [[gnu::hot]] + constexpr const invoker operator()(const record_t& p_target) const noexcept { + return invoker{ m_functor, p_target }; + } + + method(fptr_t p_functor) + : m_init_err(error::None) + , m_functor(p_functor) + { } + + method() = default; + method(method&&) = default; + method(const method&) = default; + + method& operator=(method&&) = default; + method& operator=(const method&) = default; + + GETTER(rtl::error, _init_error, m_init_err) + + private: + + fptr_t m_functor = nullptr; + error m_init_err = error::InvalidCaller; + + void set_init_error(error p_err) { + m_init_err = p_err; + } + + template + friend struct detail::HopMethod; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/dispatch/rtl_method_erased.h b/ReflectionTemplateLib/rtl/dispatch/rtl_method_erased.h new file mode 100644 index 00000000..6fd94f0e --- /dev/null +++ b/ReflectionTemplateLib/rtl/dispatch/rtl_method_erased.h @@ -0,0 +1,165 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "rtl_traits.h" +#include "rtl_forward_decls.h" +#include "lambda_base.h" + +namespace rtl +{ + template + struct method + { + struct invoker + { + const RObject& target; + const method& fn; + + template requires (sizeof...(args_t) == sizeof...(signature_t)) + [[nodiscard]] [[gnu::hot]] [[gnu::flatten]] + constexpr Return operator()(args_t&&...params) const noexcept + { + if (!fn) [[unlikely]] { + return { fn.m_init_err, RObject{} }; + } + + if (fn.must_bind_refs()) [[unlikely]] { + return { error::ExplicitRefBindingRequired, RObject{} }; + } + + auto index = (fn.m_lambdas[call_by::value] != nullptr ? call_by::value : call_by::cref); + if (fn.m_lambdas[index]->is_void()) + { + fn.m_vhop[index] (*(fn.m_lambdas[index]), target, std::forward(params)...); + return { error::None, RObject{} }; + } + else + { + return { error::None, + RObject{ fn.m_rhop[index] (*(fn.m_lambdas[index]), target, std::forward(params)...), + fn.m_lambdas.back()->get_return_id(), nullptr + } + }; + } + } + }; + + template + struct perfect_fwd + { + const RObject& target; + const method& fn; + + template + [[nodiscard]] [[gnu::hot]] [[gnu::flatten]] + constexpr Return operator()(args_t&&...params) const noexcept + { + if (!fn) [[unlikely]] { + return { fn.m_init_err, RObject{} }; + } + + auto signature_id = traits::uid>::value; + for (int index = 0; index < fn.m_lambdas.size(); index++) + { + if (fn.m_lambdas[index] != nullptr) + { + if (signature_id == fn.m_lambdas[index]->get_strict_sign_id()) + { + if (fn.m_lambdas[index]->is_void()) + { + fn.m_vhop[index] (*fn.m_lambdas[index], target, std::forward(params)...); + return { error::None, RObject{} }; + } + else + { + return { error::None, + RObject{ fn.m_rhop[index] (*fn.m_lambdas[index], target, std::forward(params)...), + fn.m_lambdas.back()->get_return_id(), nullptr + } + }; + } + } + } + } + return { error::RefBindingMismatch, RObject{} }; + } + }; + + constexpr invoker operator()(RObject& p_target) const noexcept { + return invoker{ p_target, *this }; + } + + constexpr invoker operator()(RObject&& p_target) const noexcept { + return invoker{ p_target, *this }; + } + + template + requires (std::is_same_v, std::tuple>) + constexpr const perfect_fwd bind(RObject& p_target) const noexcept { + return perfect_fwd{ p_target, *this }; + } + + template + requires (std::is_same_v, std::tuple>) + constexpr const perfect_fwd bind(RObject&& p_target) const noexcept { + return perfect_fwd{ p_target, *this }; + } + + constexpr operator bool() const noexcept { + return !(m_init_err != error::None || m_lambdas.empty() || + (m_lambdas.size() == 1 && m_lambdas[0] == nullptr)); + } + + constexpr bool must_bind_refs() const noexcept { + return (m_lambdas[call_by::value] == nullptr && + (m_lambdas.size() > call_by::ncref || m_lambdas[call_by::cref]->is_any_arg_ncref())); + } + + enum call_by + { + value = 0, + cref = 1, //const ref. + ncref = 2 //non-const ref. + }; + + GETTER(rtl::error, _init_error, m_init_err) + + private: + + using lambda_vt = std::function; + + using lambda_rt = std::function; + + std::vector m_rhop = {}; + + std::vector m_vhop = {}; + + std::vector m_lambdas = {}; + + error m_init_err = error::InvalidCaller; + + void set_init_error(error p_err) { + m_init_err = p_err; + } + + GETTER_REF(std::vector, _rhop, m_rhop) + GETTER_REF(std::vector, _vhop, m_vhop) + GETTER_REF(std::vector, _overloads, m_lambdas) + + template + friend struct detail::HopMethod; + + static_assert((!std::is_reference_v && ...), + "rtl::method<...>: any type cannot be specified as reference here."); + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/detail/inc/FunctionCaller.h b/ReflectionTemplateLib/rtl/dispatch/rtl_method_erased_const.h similarity index 55% rename from ReflectionTemplateLib/detail/inc/FunctionCaller.h rename to ReflectionTemplateLib/rtl/dispatch/rtl_method_erased_const.h index fdcfb53b..5d232a04 100644 --- a/ReflectionTemplateLib/detail/inc/FunctionCaller.h +++ b/ReflectionTemplateLib/rtl/dispatch/rtl_method_erased_const.h @@ -9,34 +9,4 @@ *************************************************************************/ -#pragma once - -#include "RObject.h" - -namespace rtl -{ - class Function; -} - -namespace rtl::detail -{ - template - struct FunctionCaller - { - //the function to be called. - const Function* m_function; - - public: - - template - rtl::Return call(_args&&...) const; - - template - constexpr rtl::Return operator()(_args&&...params) const - { - return call(std::forward<_args>(params)...); - } - - friend Function; - }; -} +#pragma once \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/dispatch/rtl_method_erased_return.h b/ReflectionTemplateLib/rtl/dispatch/rtl_method_erased_return.h new file mode 100644 index 00000000..35c9ae42 --- /dev/null +++ b/ReflectionTemplateLib/rtl/dispatch/rtl_method_erased_return.h @@ -0,0 +1,166 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "rtl_traits.h" +#include "rtl_forward_decls.h" +#include "lambda_base.h" + +namespace rtl +{ + template requires (!std::is_same_v) + struct method + { + struct invoker + { + const record_t& target; + const method& fn; + + template requires (sizeof...(args_t) == sizeof...(signature_t)) + [[nodiscard]] [[gnu::hot]] [[gnu::flatten]] + constexpr Return operator()(args_t&&...params) const noexcept + { + if (!fn) [[unlikely]] { + return { fn.m_init_err, RObject{} }; + } + + if (fn.must_bind_refs()) [[unlikely]] { + return { error::ExplicitRefBindingRequired, RObject{} }; + } + + auto index = (fn.m_lambdas[call_by::value] != nullptr ? call_by::value : call_by::cref); + if (fn.m_lambdas[index]->is_void()) + { + fn.m_vhop[index] (*(fn.m_lambdas[index]), target, std::forward(params)...); + return { error::None, RObject{} }; + } + else + { + return { error::None, + RObject{ fn.m_rhop[index] (*(fn.m_lambdas[index]), target, std::forward(params)...), + fn.m_lambdas.back()->get_return_id(), nullptr + } + }; + } + } + }; + + template + struct perfect_fwd + { + const record_t& target; + const method& fn; + + template + [[nodiscard]] [[gnu::hot]] [[gnu::flatten]] + constexpr Return operator()(args_t&&...params) const noexcept + { + if (!fn) [[unlikely]] { + return { fn.m_init_err, RObject{} }; + } + + auto signature_id = traits::uid>::value; + for (int index = 0; index < fn.m_lambdas.size(); index++) + { + if (fn.m_lambdas[index] != nullptr) + { + if (signature_id == fn.m_lambdas[index]->get_strict_sign_id()) + { + if (fn.m_lambdas[index]->is_void()) + { + fn.m_vhop[index] (*fn.m_lambdas[index], target, std::forward(params)...); + return { error::None, RObject{} }; + } + else + { + return { error::None, + RObject{ fn.m_rhop[index] (*fn.m_lambdas[index], target, std::forward(params)...), + fn.m_lambdas.back()->get_return_id(), nullptr + } + }; + } + } + } + } + return { error::RefBindingMismatch, RObject{} }; + } + }; + + constexpr invoker operator()(record_t& p_target) const noexcept { + return invoker{ p_target, *this }; + } + + constexpr invoker operator()(record_t&& p_target) const noexcept { + return invoker{ p_target, *this }; + } + + template + requires (std::is_same_v, std::tuple>) + constexpr const perfect_fwd bind(record_t& p_target) const noexcept { + return perfect_fwd{ p_target, *this }; + } + + template + requires (std::is_same_v, std::tuple>) + constexpr const perfect_fwd bind(record_t&& p_target) const noexcept { + return perfect_fwd{ p_target, *this }; + } + + constexpr operator bool() const noexcept { + return !(m_init_err != error::None || m_lambdas.empty() || + (m_lambdas.size() == 1 && m_lambdas[0] == nullptr)); + + } + + constexpr bool must_bind_refs() const noexcept { + return (m_lambdas[call_by::value] == nullptr && + (m_lambdas.size() > call_by::ncref || m_lambdas[call_by::cref]->is_any_arg_ncref())); + } + + enum call_by + { + value = 0, + cref = 1, //const ref. + ncref = 2 //non-const ref. + }; + + GETTER(rtl::error, _init_error, m_init_err) + + private: + + using lambda_vt = std::function; + + using lambda_rt = std::function; + + std::vector m_rhop = {}; + + std::vector m_vhop = {}; + + std::vector m_lambdas = {}; + + error m_init_err = error::InvalidCaller; + + void set_init_error(error p_err) { + m_init_err = p_err; + } + + GETTER_REF(std::vector, _rhop, m_rhop) + GETTER_REF(std::vector, _vhop, m_vhop) + GETTER_REF(std::vector, _overloads, m_lambdas) + + template + friend struct detail::HopMethod; + + static_assert((!std::is_reference_v && ...), + "rtl::method<...>: any type cannot be specified as reference here."); + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/dispatch/rtl_method_erased_return_const.h b/ReflectionTemplateLib/rtl/dispatch/rtl_method_erased_return_const.h new file mode 100644 index 00000000..eebd801d --- /dev/null +++ b/ReflectionTemplateLib/rtl/dispatch/rtl_method_erased_return_const.h @@ -0,0 +1,156 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "rtl_traits.h" +#include "rtl_forward_decls.h" +#include "lambda_base.h" + +namespace rtl +{ + template + struct method + { + struct invoker + { + record_t& target; + const method& fn; + + template requires (sizeof...(args_t) == sizeof...(signature_t)) + [[nodiscard]] [[gnu::hot]] [[gnu::flatten]] + constexpr Return operator()(args_t&&...params) const noexcept + { + if (!fn) [[unlikely]] { + return { fn.m_init_err, RObject{} }; + } + + if (fn.must_bind_refs()) [[unlikely]] { + return { error::ExplicitRefBindingRequired, RObject{} }; + } + + auto index = (fn.m_lambdas[call_by::value] != nullptr ? call_by::value : call_by::cref); + if (fn.m_lambdas[index]->is_void()) + { + fn.m_vhop[index] (*(fn.m_lambdas[index]), target, std::forward(params)...); + return { error::None, RObject{} }; + } + else + { + return { error::None, + RObject{ fn.m_rhop[index] (*(fn.m_lambdas[index]), target, std::forward(params)...), + fn.m_lambdas.back()->get_return_id(), nullptr + } + }; + } + } + }; + + template + struct perfect_fwd + { + const record_t& target; + const method& fn; + + template + [[nodiscard]] [[gnu::hot]] [[gnu::flatten]] + constexpr Return operator()(args_t&&...params) const noexcept + { + if (!fn) [[unlikely]] { + return { fn.m_init_err, RObject{} }; + } + + auto signature_id = traits::uid>::value; + for (int index = 0; index < fn.m_lambdas.size(); index++) + { + if (fn.m_lambdas[index] != nullptr) + { + if (signature_id == fn.m_lambdas[index]->get_strict_sign_id()) + { + if (fn.m_lambdas[index]->is_void()) + { + fn.m_vhop[index] (*fn.m_lambdas[index], target, std::forward(params)...); + return { error::None, RObject{} }; + } + else + { + return { error::None, + RObject{ fn.m_rhop[index] (*fn.m_lambdas[index], target, std::forward(params)...), + fn.m_lambdas.back()->get_return_id(), nullptr + } + }; + } + } + } + } + return { error::RefBindingMismatch, RObject{} }; + } + }; + + constexpr invoker operator()(record_t& p_target) const noexcept { + return invoker{ p_target, *this }; + } + + template + requires (std::is_same_v, std::tuple>) + constexpr const perfect_fwd bind(record_t& p_target) const noexcept { + return perfect_fwd{ p_target, *this }; + } + + constexpr operator bool() const noexcept { + return !(m_init_err != error::None || m_lambdas.empty() || + (m_lambdas.size() == 1 && m_lambdas[0] == nullptr)); + + } + + constexpr bool must_bind_refs() const noexcept { + return (m_lambdas[call_by::value] == nullptr && + (m_lambdas.size() > call_by::ncref || m_lambdas[call_by::cref]->is_any_arg_ncref())); + } + + enum call_by + { + value = 0, + cref = 1, //const ref. + ncref = 2 //non-const ref. + }; + + GETTER(rtl::error, _init_error, m_init_err) + + private: + + using lambda_vt = std::function; + + using lambda_rt = std::function; + + std::vector m_rhop = {}; + + std::vector m_vhop = {}; + + std::vector m_lambdas = {}; + + error m_init_err = error::InvalidCaller; + + void set_init_error(error p_err) { + m_init_err = p_err; + } + + GETTER_REF(std::vector, _rhop, m_rhop) + GETTER_REF(std::vector, _vhop, m_vhop) + GETTER_REF(std::vector, _overloads, m_lambdas) + + template + friend struct detail::HopMethod; + + static_assert((!std::is_reference_v && ...), + "rtl::method<...>: any type cannot be specified as reference here."); + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/dispatch/rtl_method_erased_target.h b/ReflectionTemplateLib/rtl/dispatch/rtl_method_erased_target.h new file mode 100644 index 00000000..bd206ced --- /dev/null +++ b/ReflectionTemplateLib/rtl/dispatch/rtl_method_erased_target.h @@ -0,0 +1,150 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "rtl_traits.h" +#include "rtl_forward_decls.h" +#include "lambda_base.h" + +namespace rtl +{ + template requires (!std::is_same_v) + struct method + { + struct invoker + { + const RObject& target; + const method& fn; + + template requires (sizeof...(args_t) == sizeof...(signature_t)) + [[nodiscard]] [[gnu::hot]] [[gnu::flatten]] + constexpr std::pair> operator()(args_t&&...params) const noexcept + { + if (!fn) [[unlikely]] { + return { fn.m_init_err, std::nullopt }; + } + + if (fn.must_bind_refs()) [[unlikely]] { + return { error::ExplicitRefBindingRequired, std::nullopt }; + } + + auto index = (fn.m_lambdas[call_by::value] != nullptr ? call_by::value : call_by::cref); + if (fn.m_lambdas[index]->is_void()) + { + fn.m_vhop[index] (*(fn.m_lambdas[index]), target, std::forward(params)...); + return { error::None, std::nullopt }; + } + else + { + auto&& ret_v = fn.m_rhop[index](*(fn.m_lambdas[index]), target, std::forward(params)...); + return { error::None, std::optional(std::move(ret_v)) }; + } + } + }; + + template + struct perfect_fwd + { + const RObject& target; + const method& fn; + + template + [[nodiscard]] [[gnu::hot]] [[gnu::flatten]] + constexpr std::pair> operator()(args_t&&...params) const noexcept + { + if (!fn) [[unlikely]] { + return { fn.m_init_err, std::nullopt }; + } + + auto signature_id = traits::uid>::value; + for (int index = 0; index < fn.m_lambdas.size(); index++) + { + if (fn.m_lambdas[index] != nullptr) + { + if (signature_id == fn.m_lambdas[index]->get_strict_sign_id()) + { + if (fn.m_lambdas[index]->is_void()) + { + fn.m_vhop[index] (*fn.m_lambdas[index], target, std::forward(params)...); + return { error::None, std::nullopt }; + } + else + { + auto&& ret_v = fn.m_rhop[index](*fn.m_lambdas[index], target, std::forward(params)...); + return { error::None, std::optional(std::move(ret_v)) }; + } + } + } + } + return { error::RefBindingMismatch, std::nullopt }; + } + }; + + constexpr invoker operator()(const RObject& p_target) const noexcept { + return invoker{ p_target, *this }; + } + + template + requires (std::is_same_v, std::tuple>) + constexpr const perfect_fwd bind(const RObject& p_target) const noexcept { + return perfect_fwd{ p_target, *this }; + } + + constexpr operator bool() const noexcept { + return !(m_init_err != error::None || m_lambdas.empty() || + (m_lambdas.size() == 1 && m_lambdas[0] == nullptr)); + + } + + constexpr bool must_bind_refs() const noexcept { + return (m_lambdas[call_by::value] == nullptr && + (m_lambdas.size() > call_by::ncref || m_lambdas[call_by::cref]->is_any_arg_ncref())); + } + + enum call_by + { + value = 0, + cref = 1, //const ref. + ncref = 2 //non-const ref. + }; + + GETTER(rtl::error, _init_error, m_init_err) + + private: + + using lambda_vt = std::function; + + using lambda_rt = std::function; + + std::vector m_rhop = {}; + + std::vector m_vhop = {}; + + std::vector m_lambdas = {}; + + error m_init_err = error::InvalidCaller; + + void set_init_error(error p_err) { + m_init_err = p_err; + } + + GETTER_REF(std::vector, _rhop, m_rhop) + GETTER_REF(std::vector, _vhop, m_vhop) + GETTER_REF(std::vector, _overloads, m_lambdas) + + template + friend struct detail::HopMethod; + + static_assert((!std::is_reference_v && ...), + "rtl::method<...>: any type cannot be specified as reference here."); + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/dispatch/rtl_method_erased_target_const.h b/ReflectionTemplateLib/rtl/dispatch/rtl_method_erased_target_const.h new file mode 100644 index 00000000..5d232a04 --- /dev/null +++ b/ReflectionTemplateLib/rtl/dispatch/rtl_method_erased_target_const.h @@ -0,0 +1,12 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/erasure/CMakeLists.txt b/ReflectionTemplateLib/rtl/erasure/CMakeLists.txt new file mode 100644 index 00000000..193950ab --- /dev/null +++ b/ReflectionTemplateLib/rtl/erasure/CMakeLists.txt @@ -0,0 +1,19 @@ +# ReflectionTemplateLibrary-CPP/ReflectionTemplateLib/erasure/CMakeLists.txt + +# Collect headers in this folder (absolute paths) +set(LOCAL_HEADERS + + "${CMAKE_CURRENT_SOURCE_DIR}/erasure_base.h" + "${CMAKE_CURRENT_SOURCE_DIR}/erasure_base.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/erase_return.h" + "${CMAKE_CURRENT_SOURCE_DIR}/erase_return_n_target.h" + "${CMAKE_CURRENT_SOURCE_DIR}/erase_return_aware_target.h" + "${CMAKE_CURRENT_SOURCE_DIR}/erase_target_aware_return.h" + + "${CMAKE_CURRENT_SOURCE_DIR}/aware_return.h" + "${CMAKE_CURRENT_SOURCE_DIR}/aware_return_n_target.h" + "${CMAKE_CURRENT_SOURCE_DIR}/aware_return_n_target_const.h" +) + +target_sources(ReflectionTemplateLib PRIVATE ${LOCAL_HEADERS}) +source_group("Header Files\\Erasure" FILES ${LOCAL_HEADERS}) diff --git a/ReflectionTemplateLib/rtl/erasure/aware_return.h b/ReflectionTemplateLib/rtl/erasure/aware_return.h new file mode 100644 index 00000000..6df79f9f --- /dev/null +++ b/ReflectionTemplateLib/rtl/erasure/aware_return.h @@ -0,0 +1,80 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include +#include "erase_return.h" + +namespace rtl::dispatch +{ + template + struct aware_return : public erase_return...> + { + using this_t = aware_return; + using base_t = erase_return...>; + + constexpr static bool is_void = (std::is_void_v); + + aware_return() + : base_t( is_void ? this_t::get_lambda_void() : decltype(this_t::get_lambda_void()) {}, + !is_void ? this_t::get_lambda_any_return() : decltype(this_t::get_lambda_any_return()) {}) + { + constexpr static bool is_const_cast_safe = (!traits::is_const_v); + base_t::m_return_id = detail::RObjectId::create(is_const_cast_safe); + } + + constexpr static auto get_lambda_void() noexcept + { + return [](const lambda_base& lambda, traits::normal_sign_t&&... params)-> auto + { + if constexpr (is_void) + { + auto fptr = lambda.template to_function() + .template get_functor(); + + (*fptr)(std::forward(params)...); + } + }; + } + + constexpr static auto get_lambda_any_return() noexcept + { + return [](const lambda_base& lambda, traits::normal_sign_t&&... params)-> auto + { + if constexpr (!is_void) + { + auto fptr = lambda.template to_function() + .template get_functor(); + + auto&& ret_v = (*fptr)(std::forward(params)...); + + if constexpr (std::is_pointer_v) + { + using raw_t = std::remove_pointer_t; + return std::any(static_cast(ret_v)); + } + else if constexpr (std::is_reference_v) + { + using raw_t = std::remove_cv_t>; + return std::any(static_cast(&ret_v)); + } + else + { + using raw_ct = std::add_const_t>; + return std::any(raw_ct(std::forward(ret_v))); + } + } + else return std::any(); + }; + } + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/erasure/aware_return_n_target.h b/ReflectionTemplateLib/rtl/erasure/aware_return_n_target.h new file mode 100644 index 00000000..b51cca2a --- /dev/null +++ b/ReflectionTemplateLib/rtl/erasure/aware_return_n_target.h @@ -0,0 +1,192 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include + +#include "RObjectId.h" +#include "erase_return_n_target.h" +#include "erase_return_aware_target.h" +#include "erase_target_aware_return.h" + +namespace rtl::dispatch +{ + template + struct aware_return_n_target : public erase_return_n_target...> + { + using this_t = aware_return_n_target; + using base_t = erase_return_n_target...>; + + using e_return_t = erase_return_aware_target...>; + using e_target_t = erase_target_aware_return...>; + + constexpr static bool is_void = (std::is_void_v); + + e_return_t e_return; + e_target_t e_target; + + aware_return_n_target() + : base_t( is_void ? this_t::e_return_e_target_fnv() : decltype(this_t::e_return_e_target_fnv()) {}, + !is_void ? this_t::e_return_e_target_fnr() : decltype(this_t::e_return_e_target_fnr()) {}) + + , e_return( is_void ? this_t::e_return_a_target_fnv() : decltype(this_t::e_return_a_target_fnv()) {}, + !is_void ? this_t::e_return_a_target_fnr() : decltype(this_t::e_return_a_target_fnr()) {}) + + , e_target( is_void ? this_t::e_target_a_return_fnv() : decltype(this_t::e_target_a_return_fnv()) {}, + !is_void ? this_t::e_target_a_return_fnr() : decltype(this_t::e_target_a_return_fnr()) {}) + { + constexpr static bool is_const_cast_safe = (!traits::is_const_v); + base_t::m_return_id = detail::RObjectId::create(is_const_cast_safe); + } + + void init_base() + { + e_return.m_return_id = base_t::m_return_id; + e_target.m_return_id = base_t::m_return_id; + + base_t::m_erased_return = &e_return; + base_t::m_erased_target = &e_target; + } + + // erased-return-aware-target-function-void + constexpr static auto e_return_a_target_fnv() noexcept + { + return [](const lambda_base& lambda, const record_t& p_target, traits::normal_sign_t&&... params)-> auto + { + if constexpr (is_void) + { + auto mptr = lambda.template to_method() + .template get_functor(); + + (const_cast(p_target).*mptr)(std::forward(params)...); + } + }; + } + + // erased-target-aware-return-function-void + constexpr static auto e_target_a_return_fnv() noexcept + { + return [](const lambda_base& lambda, const RObject& p_target, traits::normal_sign_t&&... params)-> void + { + if constexpr (is_void) + { + auto mptr = lambda.template to_method() + .template get_functor(); + + const auto& target = p_target.view()->get(); + + (const_cast(target).*mptr)(std::forward(params)...); + } + }; + } + + // erased-return-erased-target-function-void + constexpr static auto e_return_e_target_fnv() noexcept + { + return [](const lambda_base& lambda, const RObject& p_target, traits::normal_sign_t&&... params)-> auto + { + if constexpr (is_void) + { + auto mptr = lambda.template to_method() + .template get_functor(); + + const auto& target = p_target.view()->get(); + + (const_cast(target).*mptr)(std::forward(params)...); + } + }; + } + + // erased-target-aware-return-function-returns(return_t) + constexpr static auto e_target_a_return_fnr() noexcept + { + return [](const lambda_base& lambda, const RObject& p_target, traits::normal_sign_t&&... params)-> return_t + { + if constexpr (!is_void) + { + auto mptr = lambda.template to_method() + .template get_functor(); + + const auto& target = p_target.view()->get(); + + return (const_cast(target).*mptr)(std::forward(params)...); + } + }; + } + + // erased-return-aware-target-function-returns(std::any) + constexpr static auto e_return_a_target_fnr() noexcept + { + return [](const lambda_base& lambda, const record_t& p_target, traits::normal_sign_t&&...params)-> auto + { + if constexpr (!is_void) + { + auto mptr = lambda.template to_method() + .template get_functor(); + + auto&& ret_v = (const_cast(p_target).*mptr)(std::forward(params)...); + + if constexpr (std::is_pointer_v) + { + using raw_t = std::remove_pointer_t; + return std::any(static_cast(ret_v)); + } + else if constexpr (std::is_reference_v) + { + using raw_t = std::remove_cv_t>; + return std::any(static_cast(&ret_v)); + } + else + { + using raw_ct = std::add_const_t>; + return std::any(raw_ct(std::forward(ret_v))); + } + } + else return std::any(); + }; + } + + // erased-return-erased-target-function-returns(std::any) + constexpr static auto e_return_e_target_fnr() noexcept + { + return [](const lambda_base& lambda, const RObject& p_target, traits::normal_sign_t&&... params)-> auto + { + if constexpr (!is_void) + { + auto mptr = lambda.template to_method() + .template get_functor(); + + const auto& target = p_target.view()->get(); + + auto&& ret_v = (const_cast(target).*mptr)(std::forward(params)...); + + if constexpr (std::is_pointer_v) + { + using raw_t = std::remove_pointer_t; + return std::any(static_cast(ret_v)); + } + else if constexpr (std::is_reference_v) + { + using raw_t = std::remove_cv_t>; + return std::any(static_cast(&ret_v)); + } + else + { + using raw_ct = std::add_const_t>; + return std::any(raw_ct(std::forward(ret_v))); + } + } + else return std::any(); + }; + } + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/erasure/aware_return_n_target_const.h b/ReflectionTemplateLib/rtl/erasure/aware_return_n_target_const.h new file mode 100644 index 00000000..7ada3ac3 --- /dev/null +++ b/ReflectionTemplateLib/rtl/erasure/aware_return_n_target_const.h @@ -0,0 +1,194 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include + +#include "RObjectId.h" +#include "erase_return_n_target.h" +#include "erase_return_aware_target.h" +#include "erase_target_aware_return.h" + +namespace rtl::dispatch +{ + template + struct aware_return_n_target : public erase_return_n_target...> + { + using this_t = aware_return_n_target; + using base_t = erase_return_n_target...>; + + using e_return_t = erase_return_aware_target...>; + using e_target_t = erase_target_aware_return...>; + + constexpr static bool is_void = (std::is_void_v); + + e_return_t e_return; + e_target_t e_target; + + aware_return_n_target(const aware_return_n_target&) = delete; + + aware_return_n_target() + : base_t( is_void ? this_t::e_return_e_target_fnv() : decltype(this_t::e_return_e_target_fnv()) {}, + !is_void ? this_t::e_return_e_target_fnr() : decltype(this_t::e_return_e_target_fnr()) {}) + + , e_return( is_void ? this_t::e_return_a_target_fnv() : decltype(this_t::e_return_a_target_fnv()) {}, + !is_void ? this_t::e_return_a_target_fnr() : decltype(this_t::e_return_a_target_fnr()) {}) + + , e_target( is_void ? this_t::e_target_a_return_fnv() : decltype(this_t::e_target_a_return_fnv()) {}, + !is_void ? this_t::e_target_a_return_fnr() : decltype(this_t::e_target_a_return_fnr()) {}) + { + constexpr static bool is_const_cast_safe = (!traits::is_const_v); + base_t::m_return_id = detail::RObjectId::create(is_const_cast_safe); + } + + void init_base() + { + e_return.m_return_id = base_t::m_return_id; + e_target.m_return_id = base_t::m_return_id; + + base_t::m_erased_return = &e_return; + base_t::m_erased_target = &e_target; + } + + // erased-return-aware-target-function-void + constexpr static auto e_return_a_target_fnv() noexcept + { + return [](const lambda_base& lambda, const record_t& p_target, traits::normal_sign_t&&... params)-> auto + { + if constexpr (is_void) + { + auto mptr = lambda.template to_method() + .template get_functor(); + + (p_target.*mptr)(std::forward(params)...); + } + }; + } + + // erased-target-aware-return-function-void + constexpr static auto e_target_a_return_fnv() noexcept + { + return [](const lambda_base& lambda, const RObject& p_target, traits::normal_sign_t&&... params)-> void + { + if constexpr (is_void) + { + auto mptr = lambda.template to_method() + .template get_functor(); + + const auto& target = p_target.view()->get(); + + (target.*mptr)(std::forward(params)...); + } + }; + } + + // erased-return-erased-target-function-void + constexpr static auto e_return_e_target_fnv() noexcept + { + return [](const lambda_base& lambda, const RObject& p_target, traits::normal_sign_t&&... params)-> auto + { + if constexpr (is_void) + { + auto mptr = lambda.template to_method() + .template get_functor(); + + const auto& target = p_target.view()->get(); + + (target.*mptr)(std::forward(params)...); + } + }; + } + + // erased-target-aware-return-function-returns(return_t) + constexpr static auto e_target_a_return_fnr() noexcept + { + return [](const lambda_base& lambda, const RObject& p_target, traits::normal_sign_t&&... params)-> return_t + { + if constexpr (!is_void) + { + auto mptr = lambda.template to_method() + .template get_functor(); + + const auto& target = p_target.view()->get(); + + return (target.*mptr)(std::forward(params)...); + } + }; + } + + // erased-return-aware-target-function-returns(std::any) + constexpr static auto e_return_a_target_fnr() noexcept + { + return [](const lambda_base& lambda, const record_t& p_target, traits::normal_sign_t&&...params)-> auto + { + if constexpr (!is_void) + { + auto mptr = lambda.template to_method() + .template get_functor(); + + auto&& ret_v = (p_target.*mptr)(std::forward(params)...); + + if constexpr (std::is_pointer_v) + { + using raw_t = std::remove_pointer_t; + return std::any(static_cast(ret_v)); + } + else if constexpr (std::is_reference_v) + { + using raw_t = std::remove_cv_t>; + return std::any(static_cast(&ret_v)); + } + else + { + using raw_ct = std::add_const_t>; + return std::any(raw_ct(std::forward(ret_v))); + } + } + else return std::any(); + }; + } + + // erased-return-erased-target-function-returns(std::any) + constexpr static auto e_return_e_target_fnr() noexcept + { + return [](const lambda_base& lambda, const RObject& p_target, traits::normal_sign_t&&... params)-> auto + { + if constexpr (!is_void) + { + auto mptr = lambda.template to_method() + .template get_functor(); + + const auto& target = p_target.view()->get(); + + auto&& ret_v = (target.*mptr)(std::forward(params)...); + + if constexpr (std::is_pointer_v) + { + using raw_t = std::remove_pointer_t; + return std::any(static_cast(ret_v)); + } + else if constexpr (std::is_reference_v) + { + using raw_t = std::remove_cv_t>; + return std::any(static_cast(&ret_v)); + } + else + { + using raw_ct = std::add_const_t>; + return std::any(raw_ct(std::forward(ret_v))); + } + } + else return std::any(); + }; + } + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/erasure/erase_return.h b/ReflectionTemplateLib/rtl/erasure/erase_return.h new file mode 100644 index 00000000..086d6024 --- /dev/null +++ b/ReflectionTemplateLib/rtl/erasure/erase_return.h @@ -0,0 +1,43 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include + +#include "erasure_base.h" + +namespace rtl::dispatch +{ + template + struct erase_return : public erasure_base + { + using lambda_vt = std::function; + + using lambda_rt = std::function; + + GETTER_CREF(lambda_vt, _void_hopper, m_vhopper) + GETTER_CREF(lambda_rt, _return_hopper, m_rhopper) + + protected: + + lambda_vt m_vhopper; + + lambda_rt m_rhopper; + + erase_return( const lambda_vt& p_void_hop, + const lambda_rt& p_any_ret_hop ) noexcept + + : m_vhopper(p_void_hop) + , m_rhopper(p_any_ret_hop) + { } + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/erasure/erase_return_aware_target.h b/ReflectionTemplateLib/rtl/erasure/erase_return_aware_target.h new file mode 100644 index 00000000..891c1656 --- /dev/null +++ b/ReflectionTemplateLib/rtl/erasure/erase_return_aware_target.h @@ -0,0 +1,48 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include +#include + +#include "erasure_base.h" + +namespace rtl::dispatch +{ + template + struct erase_return_aware_target : public erasure_base + { + using lambda_vt = std::function; + + using lambda_rt = std::function; + + GETTER(lambda_vt, _void_hopper, m_vhopper) + + GETTER(lambda_rt, _return_hopper, m_rhopper) + + private: + + lambda_vt m_vhopper; + + lambda_rt m_rhopper; + + erase_return_aware_target( const lambda_vt& p_void_hop, + const lambda_rt& p_any_ret_hop ) noexcept + + : m_vhopper(p_void_hop) + , m_rhopper(p_any_ret_hop) + { } + + template + friend struct aware_return_n_target; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/erasure/erase_return_n_target.h b/ReflectionTemplateLib/rtl/erasure/erase_return_n_target.h new file mode 100644 index 00000000..74dd2f9c --- /dev/null +++ b/ReflectionTemplateLib/rtl/erasure/erase_return_n_target.h @@ -0,0 +1,57 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include + +#include "erasure_base.h" + +namespace rtl::dispatch +{ + template + struct erase_return_n_target : public erasure_base + { + using lambda_vt = std::function; + + using lambda_rt = std::function; + + GETTER_CREF(lambda_vt, _void_hopper, m_vhopper) + GETTER_CREF(lambda_rt, _return_hopper, m_rhopper) + + template + constexpr const erase_return_aware_target& to_erased_return() const + { + return static_cast&>(*m_erased_return); + } + + template + constexpr const erase_target_aware_return& to_erased_target() const + { + return static_cast&>(*m_erased_target); + } + + protected: + + lambda_vt m_vhopper; + lambda_rt m_rhopper; + + const erasure_base* m_erased_return; + const erasure_base* m_erased_target; + + erase_return_n_target( const lambda_vt& p_void_hop, + const lambda_rt& p_any_ret_hop ) noexcept + + : m_vhopper(p_void_hop) + , m_rhopper(p_any_ret_hop) + { } + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/erasure/erase_target_aware_return.h b/ReflectionTemplateLib/rtl/erasure/erase_target_aware_return.h new file mode 100644 index 00000000..77e7cc14 --- /dev/null +++ b/ReflectionTemplateLib/rtl/erasure/erase_target_aware_return.h @@ -0,0 +1,48 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include +#include + +#include "erasure_base.h" + +namespace rtl::dispatch +{ + template + struct erase_target_aware_return : public erasure_base + { + using lambda_vt = std::function; + + using lambda_rt = std::function; + + GETTER(lambda_vt, _void_hopper, m_vhopper) + + GETTER(lambda_rt, _return_hopper, m_rhopper) + + protected: + + lambda_vt m_vhopper; + + lambda_rt m_rhopper; + + erase_target_aware_return( const lambda_vt& p_void_hop, + const lambda_rt& p_any_ret_hop ) noexcept + + : m_vhopper(p_void_hop) + , m_rhopper(p_any_ret_hop) + { } + + template + friend struct aware_return_n_target; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/erasure/erasure_base.h b/ReflectionTemplateLib/rtl/erasure/erasure_base.h new file mode 100644 index 00000000..ef38c4c3 --- /dev/null +++ b/ReflectionTemplateLib/rtl/erasure/erasure_base.h @@ -0,0 +1,57 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "RObjectId.h" +#include "rtl_forward_decls.h" + +namespace rtl::dispatch +{ + struct erasure_base + { + template + using erased_return_t = erase_return...>; + + template + using erased_record_t = erase_return_n_target...>; + + template + using e_ret_a_target_t = erase_return_aware_target...>; + + template + using e_target_a_ret_t = erase_target_aware_return...>; + + template + constexpr const erased_return_t& to_erased_return() const + { + return static_cast&>(*this); + } + + template + constexpr const erased_record_t& to_erased_record() const + { + return static_cast&>(*this); + } + + template + constexpr const e_ret_a_target_t& to_erased_return_aware_target() const; + + template + constexpr const e_target_a_ret_t& to_erased_target_aware_return() const; + + protected: + + detail::RObjectId m_return_id = {}; + + friend lambda_base; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/erasure/erasure_base.hpp b/ReflectionTemplateLib/rtl/erasure/erasure_base.hpp new file mode 100644 index 00000000..cd1f0fdd --- /dev/null +++ b/ReflectionTemplateLib/rtl/erasure/erasure_base.hpp @@ -0,0 +1,36 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "erasure_base.h" +#include "erase_return_n_target.h" +#include "erase_return_aware_target.h" +#include "erase_target_aware_return.h" + +namespace rtl::dispatch +{ + template + inline constexpr const erasure_base::e_ret_a_target_t& + erasure_base::to_erased_return_aware_target() const + { + auto& erased_record = static_cast&>(*this); + return erased_record.template to_erased_return(); + } + + template + inline constexpr const erasure_base::e_target_a_ret_t& + erasure_base::to_erased_target_aware_return() const + { + auto& erased_record = static_cast&>(*this); + return erased_record.template to_erased_target(); + } +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/inc/CMakeLists.txt b/ReflectionTemplateLib/rtl/inc/CMakeLists.txt new file mode 100644 index 00000000..aff67f32 --- /dev/null +++ b/ReflectionTemplateLib/rtl/inc/CMakeLists.txt @@ -0,0 +1,22 @@ +# ReflectionTemplateLibrary-CPP/ReflectionTemplateLib/rtl/inc/CMakeLists.txt + +# Collect local headers (absolute paths) +set(LOCAL_HEADERS + "${CMAKE_CURRENT_SOURCE_DIR}/CxxMirror.h" + "${CMAKE_CURRENT_SOURCE_DIR}/CxxMirror.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/CxxMirrorToJson.h" + "${CMAKE_CURRENT_SOURCE_DIR}/Function.h" + "${CMAKE_CURRENT_SOURCE_DIR}/Function.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/Method.h" + "${CMAKE_CURRENT_SOURCE_DIR}/Method.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/Record.h" + "${CMAKE_CURRENT_SOURCE_DIR}/RObject.h" + "${CMAKE_CURRENT_SOURCE_DIR}/RObject.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/type_meta.h" + "${CMAKE_CURRENT_SOURCE_DIR}/type_meta.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/view.h" + "${CMAKE_CURRENT_SOURCE_DIR}/view.hpp" +) + +target_sources(ReflectionTemplateLib PRIVATE ${LOCAL_HEADERS}) +source_group("Header Files\\RTL" FILES ${LOCAL_HEADERS}) \ No newline at end of file diff --git a/ReflectionTemplateLib/access/inc/CxxMirror.h b/ReflectionTemplateLib/rtl/inc/CxxMirror.h similarity index 100% rename from ReflectionTemplateLib/access/inc/CxxMirror.h rename to ReflectionTemplateLib/rtl/inc/CxxMirror.h diff --git a/ReflectionTemplateLib/access/inc/CxxMirror.hpp b/ReflectionTemplateLib/rtl/inc/CxxMirror.hpp similarity index 100% rename from ReflectionTemplateLib/access/inc/CxxMirror.hpp rename to ReflectionTemplateLib/rtl/inc/CxxMirror.hpp diff --git a/ReflectionTemplateLib/access/inc/CxxMirrorToJson.h b/ReflectionTemplateLib/rtl/inc/CxxMirrorToJson.h similarity index 100% rename from ReflectionTemplateLib/access/inc/CxxMirrorToJson.h rename to ReflectionTemplateLib/rtl/inc/CxxMirrorToJson.h diff --git a/ReflectionTemplateLib/access/inc/Function.h b/ReflectionTemplateLib/rtl/inc/Function.h similarity index 61% rename from ReflectionTemplateLib/access/inc/Function.h rename to ReflectionTemplateLib/rtl/inc/Function.h index 42d0bd4a..a7abd276 100644 --- a/ReflectionTemplateLib/access/inc/Function.h +++ b/ReflectionTemplateLib/rtl/inc/Function.h @@ -11,13 +11,13 @@ #pragma once +#include #include #include -#include -#include "FunctorId.h" -#include "Constants.h" +#include "RObject.h" #include "FunctionCaller.h" +#include "rtl_constants.h" namespace rtl { @@ -34,8 +34,8 @@ namespace rtl { * perform call on the functor represented by this object. */ class Function { - //methodQ::Const/Mute represents the const/non-const member-function, Type::None for non-member & static-member functions. - detail::methodQ m_qualifier; + //member::Const/Mute represents the const/non-const member-function, Type::None for non-member & static-member functions. + detail::member m_member_kind; //type id of class/struct (if it represents a member-function, else always '0') std::size_t m_recordTypeId; @@ -49,36 +49,45 @@ namespace rtl { //name of the namespace as supplied by the user. std::string m_namespace; + mutable std::vector m_functorsMeta; + //FunctorId acts as a hash-key to look up the functor in table. multiple 'FunctoreId' for overloaded functors. mutable std::vector m_functorIds; private: Function(const std::string_view pNamespace, const std::string_view pClassName, - const std::string_view pFuncName, const detail::FunctorId& pFunctorId, - const std::size_t pRecordTypeId, const detail::methodQ pQualifier); + const std::string_view pFuncName, const type_meta& pFunctorsMeta, const detail::FunctorId& pFunctorId, + const std::size_t pRecordTypeId, const detail::member pQualifier); void addOverload(const Function& pOtherFunc) const; protected: - Function(const Function& pOther, const detail::FunctorId& pFunctorId, + Function(const Function& pOther, const type_meta& pFunctorsMeta, const detail::FunctorId& pFunctorId, const std::string_view pFunctorName); const std::size_t hasSignatureId(const std::size_t pSignatureId) const; - GETTER(detail::methodQ, Qualifier, m_qualifier); + const detail::FunctorId* hasFunctorId(const std::size_t pSignatureId) const; + + std::pair, bool> getLambdaByNormalId(const std::size_t pSignatureId) const; + + constexpr std::optional getLambdaByStrictId(const std::size_t pSignatureId) const; - GETTER_REF(std::vector, FunctorIds, m_functorIds) + GETTER(detail::member, Qualifier, m_member_kind); + + GETTER_REF_C(std::vector, FunctorIds, m_functorIds) public: //simple inlined getters. - GETTER(std::string, RecordName, m_record); - GETTER(std::string, Namespace, m_namespace); - GETTER(std::string, FunctionName, m_function); GETTER(std::size_t, RecordTypeId, m_recordTypeId); - GETTER(std::vector, Functors, m_functorIds); + GETTER_CREF(std::string, RecordName, m_record); + GETTER_CREF(std::string, Namespace, m_namespace); + GETTER_CREF(std::string, FunctionName, m_function); + GETTER_CREF(std::vector, FunctorsMeta, m_functorsMeta) + GETTER_CREF(std::vector, Functors, m_functorIds); Function() = default; Function(Function&&) = default; @@ -86,22 +95,27 @@ namespace rtl { Function& operator=(Function&&) = default; Function& operator=(const Function&) = default; - //indicates if a functor associated with it takes zero arguments. - bool hasSignature() const; + template + constexpr const detail::HopFunction argsT() const; - template bool hasSignature() const; template - Return operator()(_args&&...params) const noexcept; + bool hasSignature() const; template - const detail::FunctionCaller<_signature...> bind() const noexcept; + constexpr const detail::ErasedCaller bind() const noexcept; + + template + constexpr rtl::Return operator()(_args&&...params) const noexcept + { + return detail::ErasedCaller{ (*this) }(std::forward<_args>(params)...); + } friend detail::CxxReflection; friend detail::ReflectionBuilder; - template - friend class detail::FunctionCaller; + template + friend struct detail::ErasedCaller; }; } \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/inc/Function.hpp b/ReflectionTemplateLib/rtl/inc/Function.hpp new file mode 100644 index 00000000..b97c8e6c --- /dev/null +++ b/ReflectionTemplateLib/rtl/inc/Function.hpp @@ -0,0 +1,116 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "Function.h" +#include "FunctionCaller.hpp" +#include "RObject.h" +#include "rtl_constants.h" +#include "lambda_base.h" + + +namespace rtl +{ + template + inline constexpr const detail::ErasedCaller Function::bind() const noexcept + { + return detail::ErasedCaller{ (*this) }; + } + + template + inline constexpr const detail::HopFunction Function::argsT() const + { + return detail::Hopper{ m_functorsMeta }.argsT(); + } + + +/* @method: hasSignature<...>() + @param: set of arguments, explicitly specified as template parameter. + @return: bool, if the functor associated with this object is of certain signature or not. + * a single 'Function' object can be associated with multiple overloads of same function. + * the set of arguments passed is checked agains all registered overloads, returns true if matched with any one. +*/ template + inline bool Function::hasSignature() const + { + //hasSignatureId() returns the index of the 'lambda' in functor-container, which cannot be '-1'. + return (hasSignatureId(detail::FunctorContainer<_args...>::getContainerId()) != -1); + } + + +/* @method: hasSignatureId() + @param: const std::size_t& (signatureId to be found) + @return: the index of the functor in the functor-table. + * a 'Function' object may be associated with multiple functors in case of overloads. + * every overload will have unique 'FunctorId', contained by one 'Function' object. + * given signatureId is compared against the signatureId of all overloads registered. +*/ ForceInline const std::size_t Function::hasSignatureId(const std::size_t pSignatureId) const + { + //simple linear-search, efficient for small set of elements. + for (const auto& functorId : m_functorIds) { + if (functorId.getSignatureId() == pSignatureId) [[likely]] { + return functorId.getLambdaIndex(); + } + } + return rtl::index_none; + } + + + ForceInline const detail::FunctorId* Function::hasFunctorId(const std::size_t pSignatureId) const + { + //simple linear-search, efficient for small set of elements. + for (const auto& functorId : m_functorIds) { + if (functorId.getSignatureId() == pSignatureId) [[likely]] { + return &functorId; + } + } + return nullptr; + } + + + inline constexpr std::optional Function::getLambdaByStrictId(const std::size_t pSignatureId) const + { + //simple linear-search, efficient for small set of elements. + for (const auto& functorMeta : m_functorsMeta) { + if (pSignatureId == functorMeta.get_strict_args_id()) [[likely]] { + return { functorMeta }; + } + } + return std::nullopt; + } + + + ForceInline std::pair, bool> Function::getLambdaByNormalId(const std::size_t pSignatureId) const + { + std::optional functorMeta = getLambdaByStrictId(pSignatureId); + if (functorMeta) { + return { functorMeta, false }; + } + + std::size_t index = rtl::index_none; + for (int i = 0; i < m_functorsMeta.size(); i++) + { + if (pSignatureId == m_functorsMeta[i].get_normal_args_id()) [[likely]] { + if (index == rtl::index_none) { + index = i; + } + else return { std::nullopt, true }; + } + } + + if (index != rtl::index_none) + { + auto isAnyNonConstRefInArgsT = (m_functorsMeta[index].is_any_arg_ncref()); + return { (isAnyNonConstRefInArgsT ? std::nullopt : std::make_optional(m_functorsMeta[index])), isAnyNonConstRefInArgsT }; + } + return { std::nullopt, false }; + } +} \ No newline at end of file diff --git a/ReflectionTemplateLib/access/inc/Method.h b/ReflectionTemplateLib/rtl/inc/Method.h similarity index 57% rename from ReflectionTemplateLib/access/inc/Method.h rename to ReflectionTemplateLib/rtl/inc/Method.h index a57bcbf5..94211bb8 100644 --- a/ReflectionTemplateLib/access/inc/Method.h +++ b/ReflectionTemplateLib/rtl/inc/Method.h @@ -13,7 +13,6 @@ #include -#include "RObject.h" #include "Function.h" #include "MethodInvoker.h" @@ -35,13 +34,13 @@ namespace rtl { { } //private ctor, called by 'Record' class. - Method(const Function& pFunction, const detail::FunctorId& pFunctorId, const std::string& pFunctorName) - : Function(pFunction, pFunctorId, pFunctorName) + Method(const Function& pFunction, const type_meta& pFunctorMeta, const detail::FunctorId& pFunctorId, const std::string& pFunctorName) + : Function(pFunction, pFunctorMeta, pFunctorId, pFunctorName) { } //invokes the constructor associated with this 'Method' template - Return invokeCtor(alloc pAllocType, std::size_t pClonerIndex, _args&&...params) const; + Return invokeCtor(alloc pAllocType, const detail::FunctorId& pClonerId, _args&&...params) const; public: @@ -51,9 +50,18 @@ namespace rtl { Method& operator=(Method&&) = default; Method& operator=(const Method&) = default; + GETTER_BOOL(Const, (getQualifier() == detail::member::Const)); + using Function::bind; - GETTER_BOOL(Const, (getQualifier() == detail::methodQ::Const)); + template + constexpr const detail::ErasedCaller operator()(_args&&...params) const noexcept = delete; + + template + constexpr const detail::HopFunction argsT() const; + + template + constexpr detail::Hopper targetT() const; //indicates if a particular set of arguments accepted by the functor associated with it. template @@ -65,41 +73,22 @@ namespace rtl { template const detail::NonConstInvoker<_signature...> bind(constCast&& pTarget) const; - /* @method: operator()() - @return: lambda - * accepts no arguments for 'target', since associated functor is static-member-functions. - * returns a lambda, which forwards the call to finally call the associated static-member-function functor. - * provides syntax like,'method()(params...)', first'()' is empty & second'()' takes the actual params. - */ constexpr auto operator()() const - { - return detail::FunctionCaller<>{ this }; - } - - - /* @method: operator()(const RObject&) - @param: const RObject& (target object) - @return: lambda - * accepts 'pTarget', which contains the actual object on which the member-function functor associated with 'this' is invoked. - * returns a lambda, which forwards the call to 'call', finally invoking the associated non-static-member-function functor. - * provides syntax like, 'method(pTarget)(params...)', keeping the target & params seperate. - */ constexpr detail::DefaultInvoker<> operator()(const RObject& pTarget) const - { - return detail::DefaultInvoker<>{ this, &pTarget }; - } - - constexpr detail::NonConstInvoker<> operator()(constCast&& pTarget) const + template + constexpr const detail::ErasedInvoker<_recordType> operator()(_recordType&& pTarget) const { - return detail::NonConstInvoker<>{ this, &pTarget.m_target }; + return detail::ErasedInvoker<_recordType>{ (*this), pTarget }; } - //friends :) friend Record; friend detail::CxxReflection; - template + template friend struct detail::DefaultInvoker; - template + template friend struct detail::NonConstInvoker; + + template + friend struct detail::ErasedInvoker; }; } \ No newline at end of file diff --git a/ReflectionTemplateLib/access/inc/Method.hpp b/ReflectionTemplateLib/rtl/inc/Method.hpp similarity index 58% rename from ReflectionTemplateLib/access/inc/Method.hpp rename to ReflectionTemplateLib/rtl/inc/Method.hpp index eed7f822..01f65fc1 100644 --- a/ReflectionTemplateLib/access/inc/Method.hpp +++ b/ReflectionTemplateLib/rtl/inc/Method.hpp @@ -16,37 +16,49 @@ namespace rtl { template - FORCE_INLINE const detail::DefaultInvoker<_signature...> Method::bind(const RObject& pTarget) const + ForceInline const detail::DefaultInvoker<_signature...> Method::bind(const RObject& pTarget) const { return detail::DefaultInvoker<_signature...>{ this, &pTarget }; } template - FORCE_INLINE const detail::NonConstInvoker<_signature...> Method::bind(constCast&& pTarget) const + ForceInline const detail::NonConstInvoker<_signature...> Method::bind(constCast&& pTarget) const { return detail::NonConstInvoker<_signature...>{ this, &pTarget.m_target }; } + template + inline constexpr detail::Hopper Method::targetT() const + { + return detail::Hopper{ getFunctorsMeta() }; + } + + template + constexpr const detail::HopFunction Method::argsT() const + { + return detail::Hopper{ getFunctorsMeta() }.argsT(); + } + /* @method: invokeCtor() @params: variable arguments. @return: RStatus * calls the constructor with given arguments. */ template - inline Return Method::invokeCtor(alloc pAllocType, std::size_t pClonerIndex, _args&& ...params) const + inline Return Method::invokeCtor(alloc pAllocType, const detail::FunctorId& pClonerId, _args&& ...params) const { - using Container = detail::FunctorContainer...>; + using Container = detail::FunctorContainer...>; - std::size_t index = hasSignatureId(Container::getContainerId()); - if (index != rtl::index_none) [[likely]] { - return Container::template forwardCall<_args...>(index, pAllocType, pClonerIndex, std::forward<_args>(params)...); + const detail::FunctorId* functorId = hasFunctorId(Container::getContainerId()); + if (functorId != nullptr) [[likely]] { + return Container::template forwardCall<_args...>(*functorId, pAllocType, pClonerId, std::forward<_args>(params)...); } return { error::SignatureMismatch, RObject{} }; } -/* @method: hasSignature<...>() + /* @method: hasSignature<...>() @params: template params, <_arg0, ..._args> (expects at least one args- _args0) @return: bool * checks if the member-function functor associated with this 'Method', takes template specified arguments set or not. @@ -55,15 +67,15 @@ namespace rtl { switch (getQualifier()) { - case detail::methodQ::None: { + case detail::member::Static: { return Function::hasSignature<_args...>(); } - case detail::methodQ::NonConst: { - using Container = detail::MethodContainer; + case detail::member::NonConst: { + using Container = detail::MethodContainer; return (hasSignatureId(Container::getContainerId()) != -1); } - case detail::methodQ::Const: { - using Container = detail::MethodContainer; + case detail::member::Const: { + using Container = detail::MethodContainer; return (hasSignatureId(Container::getContainerId()) != -1); } } diff --git a/ReflectionTemplateLib/access/inc/RObject.h b/ReflectionTemplateLib/rtl/inc/RObject.h similarity index 82% rename from ReflectionTemplateLib/access/inc/RObject.h rename to ReflectionTemplateLib/rtl/inc/RObject.h index 86ded7c0..78575c16 100644 --- a/ReflectionTemplateLib/access/inc/RObject.h +++ b/ReflectionTemplateLib/rtl/inc/RObject.h @@ -11,15 +11,15 @@ #pragma once -#include -#include -#include +//#include +#include #include "view.h" -#include "TypeId.h" #include "RObjectId.h" -#include "rtl_traits.h" +#include "rtl_traits.h" +#include "rtl_errors.h" +#include "rtl_forward_decls.h" namespace rtl::detail { @@ -35,10 +35,6 @@ namespace rtl::detail namespace rtl { - struct Return; - class Function; - class CxxMirror; - //Reflecting the object within. class RObject { @@ -47,7 +43,7 @@ namespace rtl const std::vector* m_converters = nullptr; RObject(const RObject&) = default; - RObject(std::any&& pObject, detail::RObjectId&& pRObjId, + RObject(std::any&& pObject, const detail::RObjectId& pRObjId, const std::vector* pConverters) noexcept; std::size_t getConverterIndex(const std::size_t pToTypeId) const; @@ -94,17 +90,33 @@ namespace rtl template, int> = 0> std::optional> view() const noexcept; - static std::atomic& getInstanceCounter(); + static std::size_t& /*std::atomic&*/ getInstanceCounter() + { + static std::size_t/*std::atomic*/ instanceCounter = {0}; + return instanceCounter; + } //friends :) friend CxxMirror; friend detail::RObjExtractor; - template + template friend struct detail::RObjectUPtr; - template + template friend struct detail::RObjectBuilder; + + template + friend struct detail::ErasedCaller; + + template + friend struct detail::ErasedInvoker; + + template + friend struct function; + + template + friend struct method; }; struct [[nodiscard]] Return { diff --git a/ReflectionTemplateLib/access/inc/RObject.hpp b/ReflectionTemplateLib/rtl/inc/RObject.hpp similarity index 91% rename from ReflectionTemplateLib/access/inc/RObject.hpp rename to ReflectionTemplateLib/rtl/inc/RObject.hpp index 792dfcfd..67395e64 100644 --- a/ReflectionTemplateLib/access/inc/RObject.hpp +++ b/ReflectionTemplateLib/rtl/inc/RObject.hpp @@ -25,7 +25,7 @@ namespace rtl { - FORCE_INLINE RObject::RObject(std::any&& pObject, detail::RObjectId&& pRObjId, + ForceInline RObject::RObject(std::any&& pObject, const detail::RObjectId& pRObjId, const std::vector* pConverters) noexcept : m_object(std::in_place, std::move(pObject)) , m_objectId(pRObjId) @@ -59,13 +59,7 @@ namespace rtl pOther.m_converters = nullptr; return *this; } - - inline std::atomic& RObject::getInstanceCounter() - { - static std::atomic instanceCounter = {0}; - return instanceCounter; - } - + inline std::size_t RObject::getConverterIndex(const std::size_t pToTypeId) const { @@ -120,7 +114,7 @@ namespace rtl template , int>> - FORCE_INLINE std::optional> RObject::view() const noexcept + ForceInline std::optional> RObject::view() const noexcept { if (isEmpty()) { return std::nullopt; @@ -140,7 +134,7 @@ namespace rtl template , int>> - FORCE_INLINE std::optional> RObject::view() const noexcept + ForceInline std::optional> RObject::view() const noexcept { if (isEmpty()) { return std::nullopt; @@ -161,7 +155,7 @@ namespace rtl template , int>> - FORCE_INLINE std::optional> RObject::view() const noexcept + ForceInline std::optional> RObject::view() const noexcept { if (isEmpty()) { return std::nullopt; @@ -196,10 +190,10 @@ namespace rtl template<> inline Return RObject::createCopy() const { - std::size_t pClonerIndex = m_objectId.m_clonerIndex; - if (pClonerIndex != rtl::index_none) + if (m_objectId.m_clonerId.has_value()) { - return traits::Cloner::template forwardCall(pClonerIndex, alloc::Heap, pClonerIndex, *this); + const detail::FunctorId& functorId = m_objectId.m_clonerId.value(); + return traits::Cloner::template forwardCall(functorId, *this, alloc::Heap); } return { error::CloningDisabled, RObject{} }; } @@ -208,10 +202,10 @@ namespace rtl template<> inline Return RObject::createCopy() const { - std::size_t pClonerIndex = m_objectId.m_clonerIndex; - if (pClonerIndex != rtl::index_none) + if (m_objectId.m_clonerId.has_value()) { - return traits::Cloner::template forwardCall(pClonerIndex, alloc::Stack, pClonerIndex, *this); + const detail::FunctorId& functorId = m_objectId.m_clonerId.value(); + return traits::Cloner::template forwardCall(functorId, *this, alloc::Stack); } return { error::CloningDisabled, RObject{} }; } @@ -264,4 +258,4 @@ namespace rtl } } } -} +} \ No newline at end of file diff --git a/ReflectionTemplateLib/access/inc/Record.h b/ReflectionTemplateLib/rtl/inc/Record.h similarity index 92% rename from ReflectionTemplateLib/access/inc/Record.h rename to ReflectionTemplateLib/rtl/inc/Record.h index 6a608de8..498adeb9 100644 --- a/ReflectionTemplateLib/access/inc/Record.h +++ b/ReflectionTemplateLib/rtl/inc/Record.h @@ -16,7 +16,7 @@ #include #include "Method.h" -#include "Constants.h" +#include "rtl_constants.h" namespace rtl::detail { @@ -50,10 +50,9 @@ namespace rtl { : m_recordId(pRecordId) , m_namespace(pNamespace) , m_recordName(pRecordName) - { - } + { } - GETTER_REF(MethodMap, FunctionsMap, m_methods) + GETTER_REF_C(MethodMap, FunctionsMap, m_methods) public: @@ -94,8 +93,8 @@ namespace rtl { { static_assert(_alloc != rtl::alloc::None, "Instance cannot be created with 'rtl::alloc::None' option."); const auto& method = m_methods.at(detail::ctor_name(m_recordName)); - std::size_t copyCtorIndex = method.getFunctorIds()[detail::Index::CopyCtor].getIndex(); - return method.invokeCtor(_alloc, copyCtorIndex, std::forward<_ctorArgs>(params)...); + const detail::FunctorId& clonerId = method.getFunctorIds()[detail::Index::CopyCtor]; + return method.invokeCtor(_alloc, clonerId, std::forward<_ctorArgs>(params)...); } //only class which can create objects of this class & manipulates 'm_methods'. diff --git a/ReflectionTemplateLib/rtl/inc/type_meta.h b/ReflectionTemplateLib/rtl/inc/type_meta.h new file mode 100644 index 00000000..2c808ee4 --- /dev/null +++ b/ReflectionTemplateLib/rtl/inc/type_meta.h @@ -0,0 +1,78 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include +#include + +#include "functor.h" +#include "erasure_base.h" + +namespace rtl +{ + struct type_meta + { + type_meta(const dispatch::functor& p_functor) + : m_functor(p_functor) + { } + + type_meta() = default; + type_meta(type_meta&&) = default; + type_meta(const type_meta&) = default; + type_meta& operator=(type_meta&&) = default; + type_meta& operator=(const type_meta&) = default; + + GETTER_BOOL(_empty, !m_functor.has_value()) + GETTER_BOOL(_void, m_functor->get().m_is_void) + GETTER_BOOL(_any_arg_ncref, m_functor->get().m_is_any_arg_ncref) + + GETTER(std::string, _record_str, m_functor->get().m_record_str) + GETTER(std::string, _return_str, m_functor->get().m_return_str) + GETTER_CREF(std::vector, _args_id_arr, m_functor->get().m_args_type_ids) + + GETTER(traits::uid_t, _record_id, m_functor->get().m_record_id) + GETTER(traits::uid_t, _normal_args_id, m_functor->get().m_normal_args_id) + GETTER(traits::uid_t, _strict_args_id, m_functor->get().m_strict_args_id) + + GETTER(detail::member, _member_kind, m_functor->get().m_member_kind) + + GETTER_CREF(dispatch::lambda_base, _lambda, *(m_functor->get().m_lambda)) + GETTER_CREF(dispatch::erasure_base, _erasure_base, *(m_functor->get().m_erasure)) + + template + static type_meta add_function(return_t(*p_fptr)(signature_t...), traits::uid_t p_record_uid, detail::member p_member_kind, std::size_t p_index); + + template + static type_meta add_method(return_t(record_t::* p_fptr)(signature_t...), std::size_t p_index); + + template + static type_meta add_method(return_t(record_t::* p_fptr)(signature_t...) const, std::size_t p_index); + + template + using lambda_fn_t = dispatch::lambda_function<_signature...>; + + template + using lambda_mth_t = dispatch::lambda_method; + + template + constexpr const lambda_fn_t* get_lambda_function(std::size_t p_args_id = 0) const; + + template + constexpr const lambda_mth_t* get_lambda_method(std::size_t p_recordId = 0, std::size_t p_args_id = 0) const; + + private: + + using functor_t = std::optional>; + + functor_t m_functor = std::nullopt; + }; +} \ No newline at end of file diff --git a/ReflectionTemplateLib/rtl/inc/type_meta.hpp b/ReflectionTemplateLib/rtl/inc/type_meta.hpp new file mode 100644 index 00000000..38c94886 --- /dev/null +++ b/ReflectionTemplateLib/rtl/inc/type_meta.hpp @@ -0,0 +1,84 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +#include "type_meta.h" + +#include "lambda_base.h" +#include "erasure_base.h" + +#include "cache_method_ptr.h" +#include "cache_function_ptr.h" +#include "cache_method_ptr_const.h" + +#include "cache_lambda_method.h" +#include "cache_lambda_function.h" + +namespace rtl +{ + template + inline constexpr const type_meta::lambda_fn_t* type_meta::get_lambda_function(std::size_t p_argsId) const + { + return m_functor->get().m_lambda->to_function(p_argsId); + } + + template + inline constexpr const type_meta::lambda_mth_t* type_meta::get_lambda_method(std::size_t p_recordId, std::size_t p_argsId) const + { + return m_functor->get().m_lambda->to_method(p_recordId, p_argsId); + } + + template + inline type_meta type_meta::add_function(return_t(*p_fptr)(signature_t...), traits::uid_t p_record_uid, detail::member p_member_kind, std::size_t p_index) + { + auto& fc = cache::function_ptr::instance(); + auto& lc = cache::lambda_function::instance(); + + auto& functor = fc.push(p_fptr, p_record_uid, p_member_kind, p_index); + auto [lambda, elambda] = lc.push(functor); + + functor.set_lambda(lambda); + functor.set_erasure(elambda); + + return type_meta(functor); + } + + template + inline type_meta type_meta::add_method(return_t(record_t::* p_fptr)(signature_t...), std::size_t p_index) + { + auto& fc = cache::method_ptr::instance(); + auto& lc = cache::lambda_method::instance(); + + auto& functor = fc.push(p_fptr, p_index); + auto [lambda, elambda] = lc.push(functor); + + functor.set_lambda(lambda); + functor.set_erasure(elambda); + + return type_meta(functor); + } + + template + inline type_meta type_meta::add_method(return_t(record_t::* p_fptr)(signature_t...) const, std::size_t p_index) + { + auto& fc = cache::method_ptr::instance(); + auto& lc = cache::lambda_method::instance(); + + auto& functor = fc.push(p_fptr, p_index); + auto [lambda, elambda] = lc.push(functor); + + functor.set_lambda(lambda); + functor.set_erasure(elambda); + + return type_meta(functor); + } +} \ No newline at end of file diff --git a/ReflectionTemplateLib/common/view.h b/ReflectionTemplateLib/rtl/inc/view.h similarity index 100% rename from ReflectionTemplateLib/common/view.h rename to ReflectionTemplateLib/rtl/inc/view.h diff --git a/ReflectionTemplateLib/common/view.hpp b/ReflectionTemplateLib/rtl/inc/view.hpp similarity index 100% rename from ReflectionTemplateLib/common/view.hpp rename to ReflectionTemplateLib/rtl/inc/view.hpp diff --git a/ReflectionTemplateLib/common/RTLibInterface.h b/ReflectionTemplateLib/rtl/rtl.h similarity index 97% rename from ReflectionTemplateLib/common/RTLibInterface.h rename to ReflectionTemplateLib/rtl/rtl.h index 2f1cdd4d..d4185e61 100644 --- a/ReflectionTemplateLib/common/RTLibInterface.h +++ b/ReflectionTemplateLib/rtl/rtl.h @@ -87,8 +87,6 @@ /* * The root reflection container that aggregates all registrations. -* Users are expected to define a singleton CxxMirror that holds all -* records and functions: * * namespace cxx { * const rtl::CxxMirror& mirror() { diff --git a/ReflectionTemplateLib/common/Constants.h b/ReflectionTemplateLib/rtl/rtl_constants.h similarity index 83% rename from ReflectionTemplateLib/common/Constants.h rename to ReflectionTemplateLib/rtl/rtl_constants.h index d595fdc0..1ae30435 100644 --- a/ReflectionTemplateLib/common/Constants.h +++ b/ReflectionTemplateLib/rtl/rtl_constants.h @@ -11,8 +11,6 @@ #pragma once -#include "error_codes.h" - namespace rtl { // Allocation policy for rtl::RObject. @@ -22,7 +20,7 @@ namespace rtl { // cleanup is always automatic. enum class alloc { - None = 0,/* + None, /* * Assigned to empty or moved-from RObjects. * - Represents an invalid / non-owning state. * - Any attempt to call or clone results in rtl::error::EmptyRObject. @@ -104,7 +102,7 @@ namespace rtl::detail { enum class EntityKind { - None = 0, + None, Ptr, Value, Wrapper @@ -112,7 +110,7 @@ namespace rtl::detail enum class Wrapper { - None = 0, + None, Any, Weak, Unique, @@ -129,12 +127,14 @@ namespace rtl::detail }; - // MethodQ: Method qualifier + static marker. - enum class methodQ + enum class member { - None = 0, // Static method (no const/non-const qualifier) + None, // non-member functions. Const, // Const-qualified instance method - NonConst // Non-const instance method + NonConst, // Non-const instance method + Static, // Static methods + Ctor, + CopyCtor }; constexpr const std::string_view NAMESPACE_GLOBAL = "global"; @@ -144,31 +144,41 @@ namespace rtl::detail return (std::string(pRecordName) + "::" + std::string(pRecordName) + "()"); } -#define GETTER(_varType, _name, _var) \ - inline constexpr const _varType& get##_name() const { \ - return _var; \ +#define GETTER(_varType, _name, _var) \ + inline constexpr const _varType get##_name() const { \ + return _var; \ + } + +#define GETTER_REF_C(_varType, _name, _var) \ + inline constexpr _varType& get##_name() const { \ + return _var; \ } #define GETTER_REF(_varType, _name, _var) \ - inline _varType& get##_name() const { \ + inline constexpr _varType& get##_name() { \ return _var; \ } +#define GETTER_CPTR(_varType, _name, _var) \ + inline constexpr const _varType* get##_name() const { \ + return _var; \ + } + #define GETTER_CREF(_varType, _name, _var) \ - inline const _varType& get##_name() const { \ + inline constexpr const _varType& get##_name() const { \ return _var; \ } #define GETTER_BOOL(_name, _var) \ - inline const bool is##_name() const { \ + inline constexpr const bool is##_name() const { \ return _var; \ } #if defined(_MSC_VER) -#define FORCE_INLINE __forceinline +#define ForceInline __forceinline #elif defined(__GNUC__) || defined(__clang__) -#define FORCE_INLINE inline __attribute__((always_inline)) +#define ForceInline inline __attribute__((always_inline)) #else -#define FORCE_INLINE inline +#define ForceInline inline #endif } \ No newline at end of file diff --git a/ReflectionTemplateLib/common/error_codes.h b/ReflectionTemplateLib/rtl/rtl_errors.h similarity index 73% rename from ReflectionTemplateLib/common/error_codes.h rename to ReflectionTemplateLib/rtl/rtl_errors.h index 4dc5e28c..0e707e99 100644 --- a/ReflectionTemplateLib/common/error_codes.h +++ b/ReflectionTemplateLib/rtl/rtl_errors.h @@ -19,11 +19,17 @@ namespace rtl { None, EmptyRObject, + InvalidCaller, NotWrapperType, TargetMismatch, SignatureMismatch, - CloningDisabled, //Used only in case of cloning is disabled e.g, unregistered type. + RefBindingMismatch, + ExplicitRefBindingRequired, + InvalidStaticMethodCaller, + InvalidNonStaticMethodCaller, + + CloningDisabled, //Used only in case of cloning is disabled e.g, unregistered type returnd from a function. FunctionNotRegistered, //Not used by RTL at all, for external purpose only. IllegalConstCast, @@ -46,10 +52,20 @@ namespace rtl return "Empty instance: RObject does not hold any reflected object"; case error::SignatureMismatch: return "Signature mismatch: Function parameters do not match the expected signature"; + case error::RefBindingMismatch: + return "Reference binding mismatch: Argument references do not match the expected parameter bindings"; + case error::ExplicitRefBindingRequired: + return "Explicit reference binding required for correct overload resolution"; + case error::InvalidCaller: + return "Invalid callable: rtl::function/rtl::method object being used is empty."; + case error::InvalidStaticMethodCaller: + return "Invalid callable: rtl::method being used to call a static method; use rtl::static_method instead."; + case error::InvalidNonStaticMethodCaller: + return "Invalid callable: rtl::static_method being used to call a non-static method; use rtl::method instead."; case error::CloningDisabled: return "Type not registered: The requested type is not explicitly registered in the Reflection system"; case error::FunctionNotRegistered: - return "Function not registered: The requested function/method is not registered in the Reflection system"; + return "Function not registered: The requested erase_function/method is not registered in the Reflection system"; case error::TargetMismatch: return "The object you're trying to bind doesn't match the expected type of the method."; case error::NonConstOverloadMissing: diff --git a/ReflectionTemplateLib/rtl/rtl_forward_decls.h b/ReflectionTemplateLib/rtl/rtl_forward_decls.h new file mode 100644 index 00000000..5fdfc56a --- /dev/null +++ b/ReflectionTemplateLib/rtl/rtl_forward_decls.h @@ -0,0 +1,115 @@ +/************************************************************************* + * * + * Reflection Template Library (RTL) - Modern C++ Reflection Framework * + * https://github.com/ReflectCxx/ReflectionTemplateLibrary-CPP * + * * + * Copyright (c) 2025 Neeraj Singh * + * SPDX-License-Identifier: MIT * + * * + *************************************************************************/ + + +#pragma once + +namespace rtl +{ + struct Return; + + class RObject; + + class Function; + + class Method; + + class CxxMirror; + + struct type_meta; + + template + struct function; + + template + struct method; + + template + struct static_method; + + namespace detail + { + struct FunctorId; + + struct RObjectId; + + template + class FunctorContainer; + + template + struct ErasedCaller; + + template + struct ErasedInvoker; + + template + class SetupMethod; + + template + struct Hopper; + + template + struct HopFunction; + + template + struct HopMethod; + } + + namespace cache + { + template + struct lambda_function; + + template + struct lambda_method; + } + + namespace dispatch + { + struct functor; + + struct lambda_base; + + struct erasure_base; + + template + struct lambda_function; + + template + struct lambda_method; + + template + struct function_ptr; + + template + struct method_ptr; + + template + struct const_method_ptr; + + template + struct erase_return; + + template + struct aware_return; + + template + struct erase_return_n_target; + + template + struct erase_return_aware_target; + + template + struct erase_target_aware_return; + + template + struct aware_return_n_target; + } +} \ No newline at end of file diff --git a/ReflectionTemplateLib/common/rtl_traits.h b/ReflectionTemplateLib/rtl/rtl_traits.h similarity index 67% rename from ReflectionTemplateLib/common/rtl_traits.h rename to ReflectionTemplateLib/rtl/rtl_traits.h index 323c6af3..d5bf60af 100644 --- a/ReflectionTemplateLib/common/rtl_traits.h +++ b/ReflectionTemplateLib/rtl/rtl_traits.h @@ -12,33 +12,24 @@ #pragma once #include -#include -#include #include #include #include #include -#include "TypeId.h" -#include "Constants.h" +#include "rtl_typeid.h" +#include "rtl_constants.h" +#include "rtl_forward_decls.h" namespace rtl { - class RObject; - - namespace detail { - - template - class FunctorContainer; - } - namespace traits { using Converter = std::function< std::any(const std::any&, const detail::EntityKind&, detail::EntityKind&) >; using ConverterPair = std::pair< std::size_t, Converter >; - using Cloner = detail::FunctorContainer; + using Cloner = detail::FunctorContainer; } namespace traits @@ -53,7 +44,7 @@ namespace rtl // Utility: Remove const and reference qualifiers from T. template - using remove_const_n_ref_t = std::remove_const_t>; + using remove_cref_t = std::remove_const_t>; // Utility: Remove const from T if T is not a reference; otherwise, leave as is. template @@ -64,7 +55,7 @@ namespace rtl using remove_const_n_ref_n_ptr = std::remove_const_t>>>; template - inline constexpr bool is_raw_ptr_v = std::is_pointer_v>; + inline constexpr bool is_raw_ptr_v = std::is_pointer_v>; template inline constexpr bool is_const_v = (std::is_const_v> || (std::is_pointer_v && std::is_const_v>)); @@ -136,9 +127,9 @@ namespace rtl namespace traits { - template - concept has_constructor = requires(Args&&... args) { - T{ std::forward(args)... }; + template + concept has_constructor = requires(signatureT&&... args) { + T{ std::forward(args)... }; }; template @@ -151,4 +142,60 @@ namespace rtl return !(std::is_const_v || std::is_pointer_v || std::is_reference_v); } } +} + + +namespace rtl::traits +{ + using uid_t = std::uintptr_t; + + // Returns an opaque, unique identifier per type T. + // Must only be compared or hashed - never interpreted numerically. + template + class uid + { + static + #if __cpp_static_local_constexpr >= 202306L + constexpr + #endif + uid_t get() noexcept + { + if constexpr (!std::is_same_v) { + static const int unique_tag = 0; + return reinterpret_cast(&unique_tag); + } + return 0; + } + + public: + + static constexpr uid_t none = 0; + static inline const uid_t value = get(); + }; + + template + using normal_sign_t = std::remove_const_t>; + + template + using normal_sign_id_t = std::tuple...>; + + template + using strict_sign_id_t = std::tuple; + + template + inline constexpr bool is_nonconst_ref_v = ((std::is_lvalue_reference_v || std::is_rvalue_reference_v) && + !std::is_const_v>); + + template + constexpr static const bool type_aware_v = (!std::is_same_v && !std::is_same_v); + + template + constexpr static const bool return_erased_v = (!std::is_same_v && std::is_same_v); + + template + constexpr static const bool target_erased_v = (std::is_same_v && !std::is_same_v); + + template + constexpr static const bool type_erased_v = (std::is_same_v && std::is_same_v); + } \ No newline at end of file diff --git a/ReflectionTemplateLib/detail/inc/TypeId.h b/ReflectionTemplateLib/rtl/rtl_typeid.h similarity index 54% rename from ReflectionTemplateLib/detail/inc/TypeId.h rename to ReflectionTemplateLib/rtl/rtl_typeid.h index 09f4dce6..88f7697c 100644 --- a/ReflectionTemplateLib/detail/inc/TypeId.h +++ b/ReflectionTemplateLib/rtl/rtl_typeid.h @@ -11,16 +11,25 @@ #pragma once +#include #include #include -#include + +#if defined(_MSC_VER) +#define ForceInline __forceinline +#elif defined(__GNUC__) || defined(__clang__) +#define ForceInline inline __attribute__((always_inline)) +#else +#define ForceInline inline +#endif namespace rtl { - namespace detail + namespace detail { extern std::size_t generate_unique_id(); + //class to generate unique type-id for a type or combination of types. template struct TypeId; @@ -32,14 +41,25 @@ namespace rtl { //represents '_type' or 'std::nullptr_t' for TypeId<> (empty). using HEAD = _type; + using TAIL = std::nullptr_t; + //'0' represents no type. [Never change, critical.] static constexpr const std::size_t None = 0; - static const std::size_t get() + ForceInline static std::size_t get() + { + if constexpr (!std::is_same_v<_type, std::nullptr_t>) + { + //statically initialize a unique-id. + static const std::size_t TypeId = detail::generate_unique_id(); + return TypeId; + } + return None; + } + + static void get(std::vector& pIds) { - //statically initialize a unique-id. - static const std::size_t typeId = generate_unique_id(); - return typeId; + pIds.push_back(get()); } //returns the type-list as string. @@ -48,11 +68,11 @@ namespace rtl { if constexpr (std::is_same_v<_type, void>) { return std::string("void"); } - if constexpr (std::is_same_v<_type, std::string>) { - return std::string("std::string"); + if constexpr (std::is_same_v<_type, std::string*>) { + return std::string("std::string*"); } - if constexpr (std::is_same_v<_type, const std::string>) { - return std::string("const std::string"); + if constexpr (std::is_same_v<_type, const std::string*>) { + return std::string("const std::string*"); } if constexpr (std::is_same_v<_type, std::string&>) { return std::string("std::string&"); @@ -61,13 +81,34 @@ namespace rtl { return std::string("const std::string&"); } if constexpr (std::is_same_v<_type, std::string&&>) { - return std::string("const std::string&&"); + return std::string("std::string&&"); + } + if constexpr (std::is_same_v<_type, const std::string>) { + return std::string("const std::string"); + } + if constexpr (std::is_same_v<_type, std::string>) { + return std::string("std::string"); + } + if constexpr (std::is_same_v<_type, std::string_view&>) { + return std::string("std::string_view&"); + } + if constexpr (std::is_same_v<_type, const std::string_view&>) { + return std::string("const std::string_view&"); + } + if constexpr (std::is_same_v<_type, std::string_view&&>) { + return std::string("std::string_view&&"); + } + if constexpr (std::is_same_v<_type, const std::string_view>) { + return std::string("const std::string_view"); + } + if constexpr (std::is_same_v<_type, std::string_view>) { + return std::string("std::string_view"); } if constexpr (!std::is_same_v<_type, std::nullptr_t>) { return std::string(typeid(_type).name()); } if constexpr (std::is_same_v<_type, std::nullptr_t>) { - return "std::nullptr_t"; + return ""; } else return std::string(); } @@ -84,13 +125,32 @@ namespace rtl { //represents a new list created excluding '_first'. using TAIL = TypeId<_rest...>; + static void get(std::vector& pIds) + { + if constexpr (std::is_same_v) + { + pIds.push_back(TypeId::get()); + } + else { + pIds.push_back(TypeId::get()); + TAIL::get(pIds); + } + } + + //returns the type-list as string. - static std::string toString() + static std::string toString() { const std::string& tailStr = TAIL::toString(); - if (std::is_same::value) { + if (std::is_same::value) { + return ""; + } + else if constexpr (std::is_same::value) { return std::string("std::string") + ", " + tailStr; } + else if constexpr (std::is_same::value) { + return std::string("std::string_view") + ", " + tailStr; + } return (std::string(typeid(HEAD).name()) + ", " + tailStr); } }; diff --git a/ReflectionTemplateLib/rtl/src/CMakeLists.txt b/ReflectionTemplateLib/rtl/src/CMakeLists.txt new file mode 100644 index 00000000..22a75169 --- /dev/null +++ b/ReflectionTemplateLib/rtl/src/CMakeLists.txt @@ -0,0 +1,11 @@ +# ReflectionTemplateLibrary-CPP/ReflectionTemplateLib/rtl/src/CMakeLists.txt + +# Collect local sources (absolute paths) +set(LOCAL_SOURCES + "${CMAKE_CURRENT_SOURCE_DIR}/CxxMirror.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/CxxMirrorToJson.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/Function.cpp" +) + +target_sources(ReflectionTemplateLib PRIVATE ${LOCAL_SOURCES}) +source_group("Source Files\\RTL" FILES ${LOCAL_SOURCES}) \ No newline at end of file diff --git a/ReflectionTemplateLib/access/src/CxxMirror.cpp b/ReflectionTemplateLib/rtl/src/CxxMirror.cpp similarity index 87% rename from ReflectionTemplateLib/access/src/CxxMirror.cpp rename to ReflectionTemplateLib/rtl/src/CxxMirror.cpp index b0167bf2..3b3f21e8 100644 --- a/ReflectionTemplateLib/access/src/CxxMirror.cpp +++ b/ReflectionTemplateLib/rtl/src/CxxMirror.cpp @@ -8,10 +8,9 @@ * * *************************************************************************/ - +#include #include "RObject.h" #include "CxxMirror.h" -#include "ReflectCast.h" namespace rtl { @@ -32,8 +31,7 @@ namespace rtl { const Record& record = itr->second; Method ctors = record.getMethod(detail::ctor_name(record.getRecordName())).value(); - std::size_t copyCtorIndex = ctors.getFunctors()[detail::Index::CopyCtor].getIndex(); - const_cast(pTarget).m_objectId.m_clonerIndex = copyCtorIndex; + const_cast(pTarget).m_objectId.m_clonerId = ctors.getFunctors()[detail::Index::CopyCtor]; return error::None; } return error::CloningDisabled; diff --git a/ReflectionTemplateLib/access/src/CxxMirrorToJson.cpp b/ReflectionTemplateLib/rtl/src/CxxMirrorToJson.cpp similarity index 97% rename from ReflectionTemplateLib/access/src/CxxMirrorToJson.cpp rename to ReflectionTemplateLib/rtl/src/CxxMirrorToJson.cpp index cf03c065..9905c356 100644 --- a/ReflectionTemplateLib/access/src/CxxMirrorToJson.cpp +++ b/ReflectionTemplateLib/rtl/src/CxxMirrorToJson.cpp @@ -26,7 +26,7 @@ static const std::string toJson(const FunctorId& pFunctorId) { std::stringstream sout; sout << "{\"containerId\": \"" << std::to_string(pFunctorId.getSignatureId()) << "\","; - sout << "\"index\": \"" << std::to_string(pFunctorId.getIndex()) << "\","; + sout << "\"lambdaIndex\": \"" << std::to_string(pFunctorId.getLambdaIndex()) << "\","; if (pFunctorId.getRecordId() != TypeId<>::None) { sout << "\"recordId\": \"" << std::to_string(pFunctorId.getRecordId()) << "\","; } diff --git a/ReflectionTemplateLib/access/src/Function.cpp b/ReflectionTemplateLib/rtl/src/Function.cpp similarity index 86% rename from ReflectionTemplateLib/access/src/Function.cpp rename to ReflectionTemplateLib/rtl/src/Function.cpp index ad1109c9..6de57f2a 100644 --- a/ReflectionTemplateLib/access/src/Function.cpp +++ b/ReflectionTemplateLib/rtl/src/Function.cpp @@ -12,6 +12,8 @@ #include #include "Function.h" +#include "FunctorId.h" +#include "type_meta.h" namespace rtl { @@ -21,16 +23,17 @@ namespace rtl * pFunction - given name of the function as string. * pFunctorId - 'FunctorId', generated for every functor being registered. * pRecordTypeId - type id of class/struct if the functor is member-function, '0' for non-member-functions. - * pQualifier - whether the member-function is const or non-const. methodQ::None for non-member & static-member functions. + * pQualifier - whether the member-function is const or non-const. member::None for non-member & static-member functions. * 'Function' object is created for every functor (member/non-member) being registered. */ Function::Function(const std::string_view pNamespace, const std::string_view pRecord, - const std::string_view pFunction, const detail::FunctorId& pFunctorId, - const std::size_t pRecordTypeId, const detail::methodQ pQualifier) - : m_qualifier(pQualifier) + const std::string_view pFunction, const type_meta& pFunctorsMeta, const detail::FunctorId& pFunctorId, + const std::size_t pRecordTypeId, const detail::member pQualifier) + : m_member_kind(pQualifier) , m_recordTypeId(pRecordTypeId) , m_record(pRecord) , m_function(pFunction) , m_namespace(pNamespace) + , m_functorsMeta({ pFunctorsMeta }) , m_functorIds({ pFunctorId }) { } @@ -43,13 +46,14 @@ namespace rtl * the copy-constructor's 'FunctorId' is added to the 'Function' object associated with a constructor while registration. * the very first registration of constructor adds the copy-constructor lambda in the functor-container and sends its 'FunctorId' with the 'Function' object associated with a constructor. -*/ Function::Function(const Function& pOther, const detail::FunctorId& pFunctorId, +*/ Function::Function(const Function& pOther, const type_meta& pFunctorsMeta, const detail::FunctorId& pFunctorId, const std::string_view pFunctorName) - : m_qualifier(pOther.m_qualifier) + : m_member_kind(pOther.m_member_kind) , m_recordTypeId(pOther.m_recordTypeId) , m_record(pOther.m_record) , m_function(pFunctorName) , m_namespace(pOther.m_namespace) + , m_functorsMeta({ pFunctorsMeta }) , m_functorIds({ pFunctorId }) { } @@ -75,5 +79,6 @@ namespace rtl } //add the 'functorId' of the overloaded functor. m_functorIds.push_back(pOtherFunc.m_functorIds[0]); + m_functorsMeta.push_back(pOtherFunc.m_functorsMeta[0]); } } \ No newline at end of file diff --git a/run_benchmarks.sh b/run_benchmarks.sh index f2f11c4d..e6d42d56 100755 --- a/run_benchmarks.sh +++ b/run_benchmarks.sh @@ -1,6 +1,9 @@ #!/bin/bash -# Config +# =========================== +# RTL Benchmark Runner Script +# =========================== + BINARY="./bin/RTLBenchmarkApp" LOGFILE="./benchmark_runs.log" @@ -12,21 +15,44 @@ echo "Binary: $BINARY" | tee -a "$LOGFILE" echo "Log: $LOGFILE" | tee -a "$LOGFILE" echo "===================================" | tee -a "$LOGFILE" -# First handle scale=0, 10 times -SCALE=0 -for i in $(seq 1 10); do - echo ">>> Run $i: workload scale = $SCALE" | tee -a "$LOGFILE" - "$BINARY" "$SCALE" >> "$LOGFILE" 2>&1 - echo "-----------------------------------" | tee -a "$LOGFILE" -done - -# Now handle scales 25, 50, ... 200, each 5 times -for SCALE in $(seq 25 25 200); do - for i in $(seq 1 5); do - echo ">>> Run $i: workload scale = $SCALE" | tee -a "$LOGFILE" - "$BINARY" "$SCALE" >> "$LOGFILE" 2>&1 +# Helper: run workload N times +run_benchmark() { + local scale=$1 + local reps=$2 + for i in $(seq 1 "$reps"); do + echo "[$(date '+%Y-%m-%d %H:%M:%S')] >>> Run $i: workload scale = $scale" | tee -a "$LOGFILE" + if ! "$BINARY" "$scale" >> "$LOGFILE" 2>&1; then + echo "[ERROR] Binary failed at scale=$scale (run $i)" | tee -a "$LOGFILE" + fi echo "-----------------------------------" | tee -a "$LOGFILE" done +} + +# --------------------------- +# Phase 1: Baseline runs (scale 0, 10 reps) +# --------------------------- +run_benchmark 0 5 + +# --------------------------- +# Phase 2: Scales 1 → 50 +# --------------------------- +SCALES_PHASE2=(1 5 10 15 20 25 30 35 40 45 50) +for SCALE in "${SCALES_PHASE2[@]}"; do + run_benchmark "$SCALE" 3 +done + +# --------------------------- +# Phase 3: Scales 58 → 90 (step 8) +# --------------------------- +for SCALE in $(seq 58 8 90); do + run_benchmark "$SCALE" 3 +done + +# --------------------------- +# Phase 4: Final higher scales +# --------------------------- +for SCALE in 100 120 150; do + run_benchmark "$SCALE" 3 done echo "All benchmarks completed." | tee -a "$LOGFILE" diff --git a/text-benchmark-logs/benchmark_return_string_view.log b/text-benchmark-logs/benchmark_return_string_view.log deleted file mode 100644 index 1acdfca7..00000000 --- a/text-benchmark-logs/benchmark_return_string_view.log +++ /dev/null @@ -1,1655 +0,0 @@ -Starting benchmark runs... -Binary: ./bin/RTLBenchmarkApp -Log: ./benchmark_runs.log -=================================== ->>> Run 1: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:26:58+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3673.84 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 0.50, 0.43, 0.62 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2.68 ns 2.68 ns 261129948 -StdFuncCall::noReturn 3.63 ns 3.63 ns 205756521 -ReflectedCall::noReturn 4.56 ns 4.56 ns 152287993 - -StdFuncMethodCall::noReturn 3.66 ns 3.66 ns 190424278 -ReflectedMethodCall::noReturn 7.58 ns 7.58 ns 91861976 --------------------------------------------------------------------------- -DirectCall::withReturn 7.99 ns 7.99 ns 87640884 -StdFuncCall::withReturn 8.19 ns 8.19 ns 85275679 -ReflectedCall::withReturn 16.4 ns 16.4 ns 42162218 - -StdFuncMethodCall::withReturn 8.19 ns 8.19 ns 85314435 -ReflectedMethodCall::withReturn 18.4 ns 18.4 ns 38123916 ------------------------------------ ->>> Run 2: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:27:07+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4900 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 0.58, 0.45, 0.63 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2.68 ns 2.68 ns 261249982 -StdFuncCall::noReturn 3.53 ns 3.53 ns 193958493 -ReflectedCall::noReturn 4.54 ns 4.54 ns 154118128 - -StdFuncMethodCall::noReturn 3.70 ns 3.70 ns 189590103 -ReflectedMethodCall::noReturn 7.66 ns 7.66 ns 92278133 --------------------------------------------------------------------------- -DirectCall::withReturn 7.98 ns 7.98 ns 87518334 -StdFuncCall::withReturn 8.20 ns 8.20 ns 85410105 -ReflectedCall::withReturn 16.5 ns 16.5 ns 42955309 - -StdFuncMethodCall::withReturn 8.19 ns 8.19 ns 85484532 -ReflectedMethodCall::withReturn 18.5 ns 18.5 ns 37798366 ------------------------------------ ->>> Run 3: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:27:17+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4894.06 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 0.64, 0.47, 0.63 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2.68 ns 2.68 ns 262137459 -StdFuncCall::noReturn 3.66 ns 3.66 ns 186118715 -ReflectedCall::noReturn 4.56 ns 4.56 ns 152295433 - -StdFuncMethodCall::noReturn 3.65 ns 3.65 ns 193507678 -ReflectedMethodCall::noReturn 7.68 ns 7.68 ns 89857228 --------------------------------------------------------------------------- -DirectCall::withReturn 7.99 ns 7.99 ns 87152273 -StdFuncCall::withReturn 8.19 ns 8.19 ns 84706545 -ReflectedCall::withReturn 16.3 ns 16.3 ns 42842896 - -StdFuncMethodCall::withReturn 8.19 ns 8.19 ns 84681044 -ReflectedMethodCall::withReturn 18.5 ns 18.5 ns 38078832 ------------------------------------ ->>> Run 4: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:27:26+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3764.4 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 0.70, 0.48, 0.64 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2.69 ns 2.69 ns 261376697 -StdFuncCall::noReturn 3.71 ns 3.71 ns 190913629 -ReflectedCall::noReturn 4.71 ns 4.71 ns 150141200 - -StdFuncMethodCall::noReturn 3.64 ns 3.64 ns 192162902 -ReflectedMethodCall::noReturn 7.67 ns 7.67 ns 90578497 --------------------------------------------------------------------------- -DirectCall::withReturn 8.19 ns 8.19 ns 85408568 -StdFuncCall::withReturn 8.39 ns 8.39 ns 83226473 -ReflectedCall::withReturn 16.7 ns 16.7 ns 41844284 - -StdFuncMethodCall::withReturn 8.39 ns 8.39 ns 83073249 -ReflectedMethodCall::withReturn 18.4 ns 18.4 ns 37663093 ------------------------------------ ->>> Run 5: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:27:35+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 1321.93 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 0.72, 0.49, 0.64 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2.69 ns 2.69 ns 259677166 -StdFuncCall::noReturn 3.63 ns 3.63 ns 190282286 -ReflectedCall::noReturn 4.64 ns 4.64 ns 150576640 - -StdFuncMethodCall::noReturn 3.70 ns 3.70 ns 189991616 -ReflectedMethodCall::noReturn 7.59 ns 7.58 ns 88533673 --------------------------------------------------------------------------- -DirectCall::withReturn 7.98 ns 7.98 ns 86873175 -StdFuncCall::withReturn 8.20 ns 8.20 ns 84535948 -ReflectedCall::withReturn 16.5 ns 16.5 ns 42143122 - -StdFuncMethodCall::withReturn 8.19 ns 8.19 ns 85127244 -ReflectedMethodCall::withReturn 18.7 ns 18.7 ns 37470244 ------------------------------------ ->>> Run 6: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:27:45+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2798.79 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 0.76, 0.51, 0.64 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2.68 ns 2.68 ns 258313912 -StdFuncCall::noReturn 3.45 ns 3.45 ns 202668270 -ReflectedCall::noReturn 4.45 ns 4.45 ns 155726805 - -StdFuncMethodCall::noReturn 3.66 ns 3.66 ns 195257109 -ReflectedMethodCall::noReturn 7.72 ns 7.71 ns 91691488 --------------------------------------------------------------------------- -DirectCall::withReturn 8.40 ns 8.40 ns 83232030 -StdFuncCall::withReturn 8.19 ns 8.19 ns 84719682 -ReflectedCall::withReturn 16.4 ns 16.4 ns 41763228 - -StdFuncMethodCall::withReturn 8.19 ns 8.19 ns 85406769 -ReflectedMethodCall::withReturn 18.5 ns 18.5 ns 38342729 ------------------------------------ ->>> Run 7: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:27:54+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4820.72 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 0.80, 0.53, 0.65 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2.70 ns 2.70 ns 255687919 -StdFuncCall::noReturn 3.80 ns 3.80 ns 192744917 -ReflectedCall::noReturn 4.54 ns 4.54 ns 155638851 - -StdFuncMethodCall::noReturn 3.71 ns 3.71 ns 189990747 -ReflectedMethodCall::noReturn 7.65 ns 7.65 ns 90475902 --------------------------------------------------------------------------- -DirectCall::withReturn 8.41 ns 8.41 ns 82783681 -StdFuncCall::withReturn 8.19 ns 8.19 ns 85113727 -ReflectedCall::withReturn 16.4 ns 16.3 ns 43469078 - -StdFuncMethodCall::withReturn 8.21 ns 8.21 ns 85061209 -ReflectedMethodCall::withReturn 18.4 ns 18.4 ns 38318216 ------------------------------------ ->>> Run 8: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:28:04+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 800 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 0.83, 0.54, 0.65 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2.67 ns 2.67 ns 259545419 -StdFuncCall::noReturn 3.68 ns 3.68 ns 186620879 -ReflectedCall::noReturn 4.68 ns 4.68 ns 151229098 - -StdFuncMethodCall::noReturn 3.69 ns 3.69 ns 192148650 -ReflectedMethodCall::noReturn 7.65 ns 7.64 ns 92628011 --------------------------------------------------------------------------- -DirectCall::withReturn 7.98 ns 7.98 ns 87367388 -StdFuncCall::withReturn 8.20 ns 8.20 ns 85464076 -ReflectedCall::withReturn 16.4 ns 16.4 ns 41631547 - -StdFuncMethodCall::withReturn 8.19 ns 8.19 ns 84841078 -ReflectedMethodCall::withReturn 18.5 ns 18.5 ns 38096443 ------------------------------------ ->>> Run 9: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:28:13+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2581.19 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 0.86, 0.56, 0.66 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2.69 ns 2.69 ns 261320876 -StdFuncCall::noReturn 3.76 ns 3.76 ns 183274387 -ReflectedCall::noReturn 4.55 ns 4.55 ns 154257846 - -StdFuncMethodCall::noReturn 3.69 ns 3.69 ns 183824695 -ReflectedMethodCall::noReturn 7.67 ns 7.67 ns 91673266 --------------------------------------------------------------------------- -DirectCall::withReturn 8.39 ns 8.39 ns 82340975 -StdFuncCall::withReturn 8.19 ns 8.19 ns 85259148 -ReflectedCall::withReturn 16.5 ns 16.5 ns 43168408 - -StdFuncMethodCall::withReturn 8.19 ns 8.19 ns 85150908 -ReflectedMethodCall::withReturn 18.4 ns 18.4 ns 38115440 ------------------------------------ ->>> Run 10: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:28:22+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4020.89 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 0.88, 0.57, 0.66 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2.68 ns 2.68 ns 261232254 -StdFuncCall::noReturn 3.75 ns 3.75 ns 187932171 -ReflectedCall::noReturn 4.51 ns 4.51 ns 152128258 - -StdFuncMethodCall::noReturn 3.65 ns 3.64 ns 190154894 -ReflectedMethodCall::noReturn 7.63 ns 7.63 ns 92473165 --------------------------------------------------------------------------- -DirectCall::withReturn 8.40 ns 8.40 ns 83290327 -StdFuncCall::withReturn 8.18 ns 8.18 ns 85083846 -ReflectedCall::withReturn 16.7 ns 16.7 ns 41687403 - -StdFuncMethodCall::withReturn 8.20 ns 8.20 ns 85490157 -ReflectedMethodCall::withReturn 18.5 ns 18.5 ns 38928701 ------------------------------------ ->>> Run 1: workload scale = 25 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 25 iterations -============================================= - -2025-09-11T00:28:32+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3453.76 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 0.90, 0.59, 0.66 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 301 ns 301 ns 2303982 -StdFuncCall::noReturn 300 ns 300 ns 2342931 -ReflectedCall::noReturn 306 ns 306 ns 2284404 - -StdFuncMethodCall::noReturn 301 ns 301 ns 2329281 -ReflectedMethodCall::noReturn 309 ns 309 ns 2277267 --------------------------------------------------------------------------- -DirectCall::withReturn 373 ns 373 ns 1874653 -StdFuncCall::withReturn 370 ns 370 ns 1870666 -ReflectedCall::withReturn 385 ns 385 ns 1817975 - -StdFuncMethodCall::withReturn 372 ns 372 ns 1861488 -ReflectedMethodCall::withReturn 387 ns 387 ns 1808677 ------------------------------------ ->>> Run 2: workload scale = 25 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 25 iterations -============================================= - -2025-09-11T00:28:42+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 1209.55 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 0.92, 0.60, 0.67 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 307 ns 307 ns 2302722 -StdFuncCall::noReturn 305 ns 305 ns 2290835 -ReflectedCall::noReturn 303 ns 303 ns 2297945 - -StdFuncMethodCall::noReturn 306 ns 306 ns 2296470 -ReflectedMethodCall::noReturn 305 ns 305 ns 2290296 --------------------------------------------------------------------------- -DirectCall::withReturn 380 ns 380 ns 1843902 -StdFuncCall::withReturn 430 ns 430 ns 1754632 -ReflectedCall::withReturn 440 ns 440 ns 1589233 - -StdFuncMethodCall::withReturn 431 ns 431 ns 1624807 -ReflectedMethodCall::withReturn 433 ns 433 ns 1611959 ------------------------------------ ->>> Run 3: workload scale = 25 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 25 iterations -============================================= - -2025-09-11T00:28:54+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 800 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 0.93, 0.62, 0.67 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 298 ns 298 ns 2339343 -StdFuncCall::noReturn 298 ns 298 ns 2362369 -ReflectedCall::noReturn 301 ns 301 ns 2308822 - -StdFuncMethodCall::noReturn 297 ns 297 ns 2342636 -ReflectedMethodCall::noReturn 341 ns 341 ns 2303815 --------------------------------------------------------------------------- -DirectCall::withReturn 425 ns 425 ns 1654379 -StdFuncCall::withReturn 424 ns 424 ns 1650814 -ReflectedCall::withReturn 434 ns 434 ns 1612383 - -StdFuncMethodCall::withReturn 426 ns 426 ns 1639874 -ReflectedMethodCall::withReturn 434 ns 434 ns 1616096 ------------------------------------ ->>> Run 4: workload scale = 25 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 25 iterations -============================================= - -2025-09-11T00:29:05+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 800 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 0.94, 0.63, 0.67 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 341 ns 341 ns 2060360 -StdFuncCall::noReturn 334 ns 334 ns 2092530 -ReflectedCall::noReturn 336 ns 336 ns 2084367 - -StdFuncMethodCall::noReturn 335 ns 335 ns 2086575 -ReflectedMethodCall::noReturn 344 ns 344 ns 2032773 --------------------------------------------------------------------------- -DirectCall::withReturn 421 ns 421 ns 1662603 -StdFuncCall::withReturn 423 ns 423 ns 1666937 -ReflectedCall::withReturn 431 ns 431 ns 1623342 - -StdFuncMethodCall::withReturn 421 ns 421 ns 1658766 -ReflectedMethodCall::withReturn 433 ns 433 ns 1618268 ------------------------------------ ->>> Run 5: workload scale = 25 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 25 iterations -============================================= - -2025-09-11T00:29:16+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4781.24 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.03, 0.66, 0.68 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 339 ns 339 ns 2086251 -StdFuncCall::noReturn 334 ns 334 ns 2096201 -ReflectedCall::noReturn 336 ns 336 ns 2079979 - -StdFuncMethodCall::noReturn 335 ns 335 ns 2092323 -ReflectedMethodCall::noReturn 344 ns 344 ns 2037126 --------------------------------------------------------------------------- -DirectCall::withReturn 420 ns 420 ns 1666613 -StdFuncCall::withReturn 420 ns 420 ns 1674857 -ReflectedCall::withReturn 431 ns 431 ns 1620878 - -StdFuncMethodCall::withReturn 420 ns 420 ns 1654424 -ReflectedMethodCall::withReturn 432 ns 432 ns 1616853 ------------------------------------ ->>> Run 1: workload scale = 50 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 50 iterations -============================================= - -2025-09-11T00:29:27+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2132.68 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.34, 0.74, 0.71 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 901 ns 901 ns 759524 -StdFuncCall::noReturn 906 ns 906 ns 767684 -ReflectedCall::noReturn 912 ns 912 ns 765256 - -StdFuncMethodCall::noReturn 906 ns 906 ns 769566 -ReflectedMethodCall::noReturn 916 ns 916 ns 762842 --------------------------------------------------------------------------- -DirectCall::withReturn 1036 ns 1036 ns 675246 -StdFuncCall::withReturn 1035 ns 1034 ns 675401 -ReflectedCall::withReturn 1048 ns 1048 ns 667279 - -StdFuncMethodCall::withReturn 1035 ns 1034 ns 676395 -ReflectedMethodCall::withReturn 1053 ns 1053 ns 665275 ------------------------------------ ->>> Run 2: workload scale = 50 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 50 iterations -============================================= - -2025-09-11T00:29:35+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 800 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.32, 0.75, 0.71 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 897 ns 897 ns 759896 -StdFuncCall::noReturn 902 ns 902 ns 776407 -ReflectedCall::noReturn 913 ns 913 ns 769246 - -StdFuncMethodCall::noReturn 902 ns 902 ns 776430 -ReflectedMethodCall::noReturn 919 ns 918 ns 760482 --------------------------------------------------------------------------- -DirectCall::withReturn 1042 ns 1042 ns 671791 -StdFuncCall::withReturn 1041 ns 1041 ns 671217 -ReflectedCall::withReturn 1051 ns 1051 ns 664465 - -StdFuncMethodCall::withReturn 1041 ns 1041 ns 672055 -ReflectedMethodCall::withReturn 1057 ns 1057 ns 661898 ------------------------------------ ->>> Run 3: workload scale = 50 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 50 iterations -============================================= - -2025-09-11T00:29:43+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 1717.77 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.27, 0.76, 0.72 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 895 ns 894 ns 770126 -StdFuncCall::noReturn 902 ns 902 ns 775366 -ReflectedCall::noReturn 911 ns 911 ns 768376 - -StdFuncMethodCall::noReturn 901 ns 901 ns 772646 -ReflectedMethodCall::noReturn 932 ns 932 ns 748823 --------------------------------------------------------------------------- -DirectCall::withReturn 1035 ns 1035 ns 675872 -StdFuncCall::withReturn 1034 ns 1034 ns 672118 -ReflectedCall::withReturn 1052 ns 1052 ns 661468 - -StdFuncMethodCall::withReturn 1035 ns 1035 ns 672736 -ReflectedMethodCall::withReturn 1061 ns 1061 ns 659470 ------------------------------------ ->>> Run 4: workload scale = 50 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 50 iterations -============================================= - -2025-09-11T00:29:51+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2364.83 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.23, 0.76, 0.72 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 899 ns 899 ns 757381 -StdFuncCall::noReturn 904 ns 904 ns 769320 -ReflectedCall::noReturn 911 ns 911 ns 762634 - -StdFuncMethodCall::noReturn 902 ns 902 ns 767011 -ReflectedMethodCall::noReturn 954 ns 954 ns 726736 --------------------------------------------------------------------------- -DirectCall::withReturn 1075 ns 1075 ns 651123 -StdFuncCall::withReturn 1078 ns 1078 ns 648677 -ReflectedCall::withReturn 1087 ns 1087 ns 640363 - -StdFuncMethodCall::withReturn 1076 ns 1076 ns 648598 -ReflectedMethodCall::withReturn 1118 ns 1118 ns 625917 ------------------------------------ ->>> Run 5: workload scale = 50 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 50 iterations -============================================= - -2025-09-11T00:29:59+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 800 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.21, 0.77, 0.72 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 896 ns 896 ns 767762 -StdFuncCall::noReturn 910 ns 910 ns 763215 -ReflectedCall::noReturn 923 ns 923 ns 755913 - -StdFuncMethodCall::noReturn 910 ns 909 ns 760598 -ReflectedMethodCall::noReturn 928 ns 928 ns 750732 --------------------------------------------------------------------------- -DirectCall::withReturn 1080 ns 1080 ns 644211 -StdFuncCall::withReturn 1081 ns 1081 ns 642103 -ReflectedCall::withReturn 1095 ns 1095 ns 638553 - -StdFuncMethodCall::withReturn 1082 ns 1082 ns 642934 -ReflectedMethodCall::withReturn 1098 ns 1098 ns 633816 ------------------------------------ ->>> Run 1: workload scale = 75 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 75 iterations -============================================= - -2025-09-11T00:30:08+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2499.32 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.17, 0.78, 0.73 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 1718 ns 1718 ns 403509 -StdFuncCall::noReturn 1711 ns 1711 ns 408919 -ReflectedCall::noReturn 1719 ns 1719 ns 406569 - -StdFuncMethodCall::noReturn 1710 ns 1710 ns 409246 -ReflectedMethodCall::noReturn 1735 ns 1735 ns 403276 --------------------------------------------------------------------------- -DirectCall::withReturn 1942 ns 1942 ns 360231 -StdFuncCall::withReturn 1944 ns 1944 ns 359937 -ReflectedCall::withReturn 1967 ns 1967 ns 355508 - -StdFuncMethodCall::withReturn 1945 ns 1945 ns 360153 -ReflectedMethodCall::withReturn 1971 ns 1971 ns 354944 ------------------------------------ ->>> Run 2: workload scale = 75 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 75 iterations -============================================= - -2025-09-11T00:30:17+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2418.55 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.15, 0.78, 0.73 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 1720 ns 1719 ns 403240 -StdFuncCall::noReturn 1711 ns 1711 ns 409539 -ReflectedCall::noReturn 1722 ns 1722 ns 407137 - -StdFuncMethodCall::noReturn 1710 ns 1710 ns 408876 -ReflectedMethodCall::noReturn 1735 ns 1735 ns 403563 --------------------------------------------------------------------------- -DirectCall::withReturn 1905 ns 1905 ns 364610 -StdFuncCall::withReturn 1906 ns 1905 ns 367144 -ReflectedCall::withReturn 1932 ns 1931 ns 362876 - -StdFuncMethodCall::withReturn 1904 ns 1904 ns 367010 -ReflectedMethodCall::withReturn 1941 ns 1940 ns 360733 ------------------------------------ ->>> Run 3: workload scale = 75 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 75 iterations -============================================= - -2025-09-11T00:30:26+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4754.64 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.14, 0.79, 0.73 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 1700 ns 1700 ns 408515 -StdFuncCall::noReturn 1706 ns 1706 ns 411515 -ReflectedCall::noReturn 1711 ns 1710 ns 409353 - -StdFuncMethodCall::noReturn 1702 ns 1702 ns 410901 -ReflectedMethodCall::noReturn 1723 ns 1722 ns 406169 --------------------------------------------------------------------------- -DirectCall::withReturn 1888 ns 1888 ns 370526 -StdFuncCall::withReturn 1888 ns 1887 ns 370612 -ReflectedCall::withReturn 1916 ns 1916 ns 365093 - -StdFuncMethodCall::withReturn 1890 ns 1889 ns 371318 -ReflectedMethodCall::withReturn 1927 ns 1927 ns 362766 ------------------------------------ ->>> Run 4: workload scale = 75 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 75 iterations -============================================= - -2025-09-11T00:30:35+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 1859.33 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.11, 0.80, 0.73 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 1708 ns 1707 ns 404396 -StdFuncCall::noReturn 1709 ns 1708 ns 409461 -ReflectedCall::noReturn 1717 ns 1717 ns 407033 - -StdFuncMethodCall::noReturn 1708 ns 1708 ns 409492 -ReflectedMethodCall::noReturn 1732 ns 1731 ns 404102 --------------------------------------------------------------------------- -DirectCall::withReturn 1949 ns 1948 ns 359921 -StdFuncCall::withReturn 1944 ns 1944 ns 360031 -ReflectedCall::withReturn 1969 ns 1968 ns 355377 - -StdFuncMethodCall::withReturn 2043 ns 2042 ns 358913 -ReflectedMethodCall::withReturn 2102 ns 2102 ns 351247 ------------------------------------ ->>> Run 5: workload scale = 75 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 75 iterations -============================================= - -2025-09-11T00:30:44+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4274.37 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.10, 0.80, 0.74 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 1854 ns 1853 ns 369519 -StdFuncCall::noReturn 1804 ns 1804 ns 389051 -ReflectedCall::noReturn 1768 ns 1767 ns 372147 - -StdFuncMethodCall::noReturn 1845 ns 1845 ns 366941 -ReflectedMethodCall::noReturn 1892 ns 1891 ns 390576 --------------------------------------------------------------------------- -DirectCall::withReturn 2059 ns 2059 ns 321965 -StdFuncCall::withReturn 2102 ns 2102 ns 331998 -ReflectedCall::withReturn 2122 ns 2122 ns 333219 - -StdFuncMethodCall::withReturn 2060 ns 2060 ns 333788 -ReflectedMethodCall::withReturn 2079 ns 2079 ns 331928 ------------------------------------ ->>> Run 1: workload scale = 100 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 100 iterations -============================================= - -2025-09-11T00:30:53+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 800 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.24, 0.84, 0.75 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 1960 ns 1959 ns 357975 -StdFuncCall::noReturn 2034 ns 2034 ns 341249 -ReflectedCall::noReturn 2022 ns 2022 ns 341827 - -StdFuncMethodCall::noReturn 2013 ns 2013 ns 303915 -ReflectedMethodCall::noReturn 2014 ns 2014 ns 343680 --------------------------------------------------------------------------- -DirectCall::withReturn 2207 ns 2207 ns 310242 -StdFuncCall::withReturn 2217 ns 2216 ns 310202 -ReflectedCall::withReturn 2254 ns 2253 ns 304225 - -StdFuncMethodCall::withReturn 2240 ns 2239 ns 306452 -ReflectedMethodCall::withReturn 2265 ns 2264 ns 299926 ------------------------------------ ->>> Run 2: workload scale = 100 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 100 iterations -============================================= - -2025-09-11T00:31:02+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3021.9 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.43, 0.90, 0.77 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 1981 ns 1981 ns 342744 -StdFuncCall::noReturn 1966 ns 1965 ns 352075 -ReflectedCall::noReturn 2002 ns 2001 ns 345397 - -StdFuncMethodCall::noReturn 2081 ns 2080 ns 341551 -ReflectedMethodCall::noReturn 1969 ns 1969 ns 333753 --------------------------------------------------------------------------- -DirectCall::withReturn 2207 ns 2207 ns 316294 -StdFuncCall::withReturn 2208 ns 2207 ns 308338 -ReflectedCall::withReturn 2215 ns 2215 ns 312972 - -StdFuncMethodCall::withReturn 2192 ns 2191 ns 314740 -ReflectedMethodCall::withReturn 2224 ns 2223 ns 305823 ------------------------------------ ->>> Run 3: workload scale = 100 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 100 iterations -============================================= - -2025-09-11T00:31:11+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4705.12 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.44, 0.92, 0.78 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 1940 ns 1939 ns 350727 -StdFuncCall::noReturn 1965 ns 1965 ns 347915 -ReflectedCall::noReturn 1951 ns 1951 ns 352534 - -StdFuncMethodCall::noReturn 1938 ns 1938 ns 359757 -ReflectedMethodCall::noReturn 1965 ns 1964 ns 356003 --------------------------------------------------------------------------- -DirectCall::withReturn 2195 ns 2194 ns 317298 -StdFuncCall::withReturn 2197 ns 2196 ns 316093 -ReflectedCall::withReturn 2214 ns 2213 ns 302642 - -StdFuncMethodCall::withReturn 2197 ns 2197 ns 318178 -ReflectedMethodCall::withReturn 2227 ns 2226 ns 313484 ------------------------------------ ->>> Run 4: workload scale = 100 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 100 iterations -============================================= - -2025-09-11T00:31:21+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2658.72 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.48, 0.94, 0.79 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2027 ns 2027 ns 330486 -StdFuncCall::noReturn 2014 ns 2013 ns 352994 -ReflectedCall::noReturn 2031 ns 2030 ns 345623 - -StdFuncMethodCall::noReturn 1982 ns 1982 ns 341573 -ReflectedMethodCall::noReturn 2017 ns 2017 ns 349908 --------------------------------------------------------------------------- -DirectCall::withReturn 2296 ns 2296 ns 294346 -StdFuncCall::withReturn 2321 ns 2319 ns 300846 -ReflectedCall::withReturn 2360 ns 2360 ns 286766 - -StdFuncMethodCall::withReturn 2270 ns 2270 ns 301661 -ReflectedMethodCall::withReturn 2284 ns 2284 ns 291059 ------------------------------------ ->>> Run 5: workload scale = 100 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 100 iterations -============================================= - -2025-09-11T00:31:30+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2259.74 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.71, 1.00, 0.81 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 1977 ns 1977 ns 353401 -StdFuncCall::noReturn 2000 ns 2000 ns 345838 -ReflectedCall::noReturn 1986 ns 1985 ns 351401 - -StdFuncMethodCall::noReturn 1963 ns 1962 ns 353888 -ReflectedMethodCall::noReturn 1965 ns 1965 ns 348781 --------------------------------------------------------------------------- -DirectCall::withReturn 2208 ns 2207 ns 312994 -StdFuncCall::withReturn 2208 ns 2208 ns 312348 -ReflectedCall::withReturn 2234 ns 2234 ns 311258 - -StdFuncMethodCall::withReturn 2210 ns 2209 ns 313612 -ReflectedMethodCall::withReturn 2243 ns 2243 ns 310464 ------------------------------------ ->>> Run 1: workload scale = 125 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 125 iterations -============================================= - -2025-09-11T00:31:39+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2565.99 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.89, 1.07, 0.83 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2186 ns 2186 ns 298930 -StdFuncCall::noReturn 2180 ns 2179 ns 316013 -ReflectedCall::noReturn 2185 ns 2185 ns 317280 - -StdFuncMethodCall::noReturn 2178 ns 2178 ns 318283 -ReflectedMethodCall::noReturn 2199 ns 2199 ns 317096 --------------------------------------------------------------------------- -DirectCall::withReturn 2651 ns 2651 ns 262036 -StdFuncCall::withReturn 2659 ns 2659 ns 262524 -ReflectedCall::withReturn 2687 ns 2686 ns 259459 - -StdFuncMethodCall::withReturn 2662 ns 2661 ns 260168 -ReflectedMethodCall::withReturn 2689 ns 2689 ns 255403 ------------------------------------ ->>> Run 2: workload scale = 125 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 125 iterations -============================================= - -2025-09-11T00:31:49+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 800 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.76, 1.07, 0.84 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2167 ns 2166 ns 317573 -StdFuncCall::noReturn 2178 ns 2178 ns 319987 -ReflectedCall::noReturn 2173 ns 2172 ns 319725 - -StdFuncMethodCall::noReturn 2167 ns 2167 ns 319864 -ReflectedMethodCall::noReturn 2215 ns 2215 ns 314983 --------------------------------------------------------------------------- -DirectCall::withReturn 2597 ns 2596 ns 267537 -StdFuncCall::withReturn 2609 ns 2608 ns 263587 -ReflectedCall::withReturn 2639 ns 2638 ns 264562 - -StdFuncMethodCall::withReturn 2594 ns 2593 ns 268609 -ReflectedMethodCall::withReturn 2649 ns 2648 ns 261252 ------------------------------------ ->>> Run 3: workload scale = 125 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 125 iterations -============================================= - -2025-09-11T00:31:59+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 800 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.64, 1.06, 0.84 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2187 ns 2187 ns 311240 -StdFuncCall::noReturn 2195 ns 2195 ns 321853 -ReflectedCall::noReturn 2195 ns 2194 ns 315480 - -StdFuncMethodCall::noReturn 2188 ns 2187 ns 319537 -ReflectedMethodCall::noReturn 2212 ns 2212 ns 315561 --------------------------------------------------------------------------- -DirectCall::withReturn 2636 ns 2635 ns 264251 -StdFuncCall::withReturn 2625 ns 2624 ns 264662 -ReflectedCall::withReturn 2654 ns 2653 ns 261530 - -StdFuncMethodCall::withReturn 2625 ns 2625 ns 262978 -ReflectedMethodCall::withReturn 2668 ns 2668 ns 259997 ------------------------------------ ->>> Run 4: workload scale = 125 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 125 iterations -============================================= - -2025-09-11T00:32:08+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 800 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.54, 1.06, 0.84 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2181 ns 2180 ns 317614 -StdFuncCall::noReturn 2172 ns 2172 ns 317161 -ReflectedCall::noReturn 2190 ns 2190 ns 321018 - -StdFuncMethodCall::noReturn 2281 ns 2281 ns 304077 -ReflectedMethodCall::noReturn 2242 ns 2242 ns 290170 --------------------------------------------------------------------------- -DirectCall::withReturn 2601 ns 2601 ns 266644 -StdFuncCall::withReturn 2723 ns 2723 ns 263459 -ReflectedCall::withReturn 2724 ns 2723 ns 257965 - -StdFuncMethodCall::withReturn 2611 ns 2611 ns 262426 -ReflectedMethodCall::withReturn 2683 ns 2682 ns 258950 ------------------------------------ ->>> Run 5: workload scale = 125 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 125 iterations -============================================= - -2025-09-11T00:32:18+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 800 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.46, 1.06, 0.84 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2195 ns 2195 ns 313426 -StdFuncCall::noReturn 2183 ns 2182 ns 312811 -ReflectedCall::noReturn 2182 ns 2181 ns 320013 - -StdFuncMethodCall::noReturn 2184 ns 2184 ns 318661 -ReflectedMethodCall::noReturn 2194 ns 2194 ns 317609 --------------------------------------------------------------------------- -DirectCall::withReturn 2601 ns 2601 ns 261526 -StdFuncCall::withReturn 2598 ns 2597 ns 266007 -ReflectedCall::withReturn 2623 ns 2623 ns 264649 - -StdFuncMethodCall::withReturn 2593 ns 2593 ns 268179 -ReflectedMethodCall::withReturn 2643 ns 2642 ns 261745 ------------------------------------ ->>> Run 1: workload scale = 150 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 150 iterations -============================================= - -2025-09-11T00:32:28+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 800 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.46, 1.07, 0.85 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3533 ns 3532 ns 195801 -StdFuncCall::noReturn 3526 ns 3525 ns 197420 -ReflectedCall::noReturn 3535 ns 3535 ns 196633 - -StdFuncMethodCall::noReturn 3524 ns 3523 ns 197148 -ReflectedMethodCall::noReturn 3546 ns 3546 ns 194787 --------------------------------------------------------------------------- -DirectCall::withReturn 3992 ns 3992 ns 173680 -StdFuncCall::withReturn 3995 ns 3994 ns 174034 -ReflectedCall::withReturn 4028 ns 4028 ns 172386 - -StdFuncMethodCall::withReturn 3989 ns 3989 ns 173898 -ReflectedMethodCall::withReturn 4041 ns 4040 ns 172324 ------------------------------------ ->>> Run 2: workload scale = 150 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 150 iterations -============================================= - -2025-09-11T00:32:39+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3872.32 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.47, 1.09, 0.86 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3520 ns 3520 ns 194024 -StdFuncCall::noReturn 3532 ns 3532 ns 196774 -ReflectedCall::noReturn 3531 ns 3530 ns 196912 - -StdFuncMethodCall::noReturn 3527 ns 3526 ns 197173 -ReflectedMethodCall::noReturn 3545 ns 3544 ns 195935 --------------------------------------------------------------------------- -DirectCall::withReturn 3988 ns 3987 ns 174580 -StdFuncCall::withReturn 3986 ns 3985 ns 175002 -ReflectedCall::withReturn 4015 ns 4014 ns 172705 - -StdFuncMethodCall::withReturn 4088 ns 4087 ns 174540 -ReflectedMethodCall::withReturn 4095 ns 4094 ns 169848 ------------------------------------ ->>> Run 3: workload scale = 150 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 150 iterations -============================================= - -2025-09-11T00:32:50+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 800 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.40, 1.08, 0.86 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3552 ns 3552 ns 195236 -StdFuncCall::noReturn 3563 ns 3562 ns 195128 -ReflectedCall::noReturn 3559 ns 3558 ns 195504 - -StdFuncMethodCall::noReturn 3559 ns 3559 ns 195249 -ReflectedMethodCall::noReturn 3574 ns 3573 ns 195050 --------------------------------------------------------------------------- -DirectCall::withReturn 4036 ns 4035 ns 173264 -StdFuncCall::withReturn 4022 ns 4021 ns 171261 -ReflectedCall::withReturn 4060 ns 4059 ns 171454 - -StdFuncMethodCall::withReturn 4025 ns 4024 ns 172789 -ReflectedMethodCall::withReturn 4065 ns 4064 ns 171108 ------------------------------------ ->>> Run 4: workload scale = 150 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 150 iterations -============================================= - -2025-09-11T00:33:01+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 800 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.41, 1.10, 0.87 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3500 ns 3500 ns 197777 -StdFuncCall::noReturn 3519 ns 3518 ns 198267 -ReflectedCall::noReturn 3539 ns 3538 ns 197240 - -StdFuncMethodCall::noReturn 3539 ns 3538 ns 197720 -ReflectedMethodCall::noReturn 3563 ns 3563 ns 196002 --------------------------------------------------------------------------- -DirectCall::withReturn 4079 ns 4078 ns 171166 -StdFuncCall::withReturn 4069 ns 4069 ns 171810 -ReflectedCall::withReturn 4099 ns 4097 ns 170406 - -StdFuncMethodCall::withReturn 4063 ns 4061 ns 170961 -ReflectedMethodCall::withReturn 4036 ns 4035 ns 172161 ------------------------------------ ->>> Run 5: workload scale = 150 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 150 iterations -============================================= - -2025-09-11T00:33:12+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 1801.89 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.39, 1.11, 0.87 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3537 ns 3536 ns 198280 -StdFuncCall::noReturn 3515 ns 3515 ns 198830 -ReflectedCall::noReturn 3521 ns 3520 ns 198314 - -StdFuncMethodCall::noReturn 3514 ns 3514 ns 196875 -ReflectedMethodCall::noReturn 3586 ns 3586 ns 194396 --------------------------------------------------------------------------- -DirectCall::withReturn 4039 ns 4038 ns 173252 -StdFuncCall::withReturn 4029 ns 4029 ns 174445 -ReflectedCall::withReturn 4015 ns 4014 ns 172859 - -StdFuncMethodCall::withReturn 3996 ns 3996 ns 174457 -ReflectedMethodCall::withReturn 4030 ns 4029 ns 172232 ------------------------------------ ->>> Run 1: workload scale = 175 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 175 iterations -============================================= - -2025-09-11T00:33:24+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4390.34 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.33, 1.10, 0.88 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3802 ns 3801 ns 184513 -StdFuncCall::noReturn 3795 ns 3794 ns 184144 -ReflectedCall::noReturn 3790 ns 3789 ns 184898 - -StdFuncMethodCall::noReturn 3765 ns 3764 ns 177760 -ReflectedMethodCall::noReturn 3778 ns 3778 ns 183638 --------------------------------------------------------------------------- -DirectCall::withReturn 4329 ns 4328 ns 161157 -StdFuncCall::withReturn 4332 ns 4330 ns 160003 -ReflectedCall::withReturn 4367 ns 4366 ns 159612 - -StdFuncMethodCall::withReturn 4335 ns 4335 ns 160361 -ReflectedMethodCall::withReturn 4372 ns 4371 ns 159538 ------------------------------------ ->>> Run 2: workload scale = 175 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 175 iterations -============================================= - -2025-09-11T00:33:35+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4300.1 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.28, 1.10, 0.88 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3778 ns 3777 ns 183159 -StdFuncCall::noReturn 3762 ns 3761 ns 185032 -ReflectedCall::noReturn 3764 ns 3762 ns 185710 - -StdFuncMethodCall::noReturn 3758 ns 3757 ns 185331 -ReflectedMethodCall::noReturn 3779 ns 3778 ns 176155 --------------------------------------------------------------------------- -DirectCall::withReturn 4339 ns 4338 ns 159051 -StdFuncCall::withReturn 4342 ns 4342 ns 160567 -ReflectedCall::withReturn 4363 ns 4362 ns 159875 - -StdFuncMethodCall::withReturn 4338 ns 4337 ns 160163 -ReflectedMethodCall::withReturn 4382 ns 4382 ns 159491 ------------------------------------ ->>> Run 3: workload scale = 175 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 175 iterations -============================================= - -2025-09-11T00:33:47+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 800 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.21, 1.09, 0.88 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3768 ns 3767 ns 186032 -StdFuncCall::noReturn 3753 ns 3753 ns 181678 -ReflectedCall::noReturn 3767 ns 3767 ns 184272 - -StdFuncMethodCall::noReturn 3759 ns 3758 ns 183679 -ReflectedMethodCall::noReturn 3774 ns 3773 ns 184695 --------------------------------------------------------------------------- -DirectCall::withReturn 4341 ns 4341 ns 160622 -StdFuncCall::withReturn 4356 ns 4355 ns 159689 -ReflectedCall::withReturn 4369 ns 4368 ns 159362 - -StdFuncMethodCall::withReturn 4353 ns 4352 ns 160835 -ReflectedMethodCall::withReturn 4376 ns 4375 ns 159727 ------------------------------------ ->>> Run 4: workload scale = 175 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 175 iterations -============================================= - -2025-09-11T00:33:58+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 800 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.26, 1.11, 0.89 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3755 ns 3754 ns 186615 -StdFuncCall::noReturn 3745 ns 3744 ns 184616 -ReflectedCall::noReturn 3771 ns 3771 ns 185449 - -StdFuncMethodCall::noReturn 3747 ns 3747 ns 186113 -ReflectedMethodCall::noReturn 3773 ns 3772 ns 182904 --------------------------------------------------------------------------- -DirectCall::withReturn 4325 ns 4323 ns 161325 -StdFuncCall::withReturn 4321 ns 4321 ns 160422 -ReflectedCall::withReturn 4348 ns 4347 ns 159032 - -StdFuncMethodCall::withReturn 4315 ns 4315 ns 159476 -ReflectedMethodCall::withReturn 4363 ns 4362 ns 159343 ------------------------------------ ->>> Run 5: workload scale = 175 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 175 iterations -============================================= - -2025-09-11T00:34:10+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 800 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.22, 1.10, 0.89 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3824 ns 3823 ns 182597 -StdFuncCall::noReturn 3822 ns 3822 ns 182367 -ReflectedCall::noReturn 3835 ns 3835 ns 182224 - -StdFuncMethodCall::noReturn 3820 ns 3820 ns 182550 -ReflectedMethodCall::noReturn 3878 ns 3877 ns 179398 --------------------------------------------------------------------------- -DirectCall::withReturn 4498 ns 4497 ns 153854 -StdFuncCall::withReturn 4437 ns 4436 ns 157785 -ReflectedCall::withReturn 4484 ns 4483 ns 156149 - -StdFuncMethodCall::withReturn 4469 ns 4467 ns 155734 -ReflectedMethodCall::withReturn 4484 ns 4483 ns 154092 ------------------------------------ ->>> Run 1: workload scale = 200 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 200 iterations -============================================= - -2025-09-11T00:34:21+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2714.66 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.19, 1.10, 0.89 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 4158 ns 4157 ns 168841 -StdFuncCall::noReturn 4107 ns 4107 ns 167421 -ReflectedCall::noReturn 4073 ns 4072 ns 172223 - -StdFuncMethodCall::noReturn 4072 ns 4071 ns 171726 -ReflectedMethodCall::noReturn 4078 ns 4077 ns 171379 --------------------------------------------------------------------------- -DirectCall::withReturn 4718 ns 4718 ns 148098 -StdFuncCall::withReturn 4703 ns 4702 ns 146865 -ReflectedCall::withReturn 4735 ns 4733 ns 146683 - -StdFuncMethodCall::withReturn 4858 ns 4858 ns 147228 -ReflectedMethodCall::withReturn 4877 ns 4876 ns 135299 ------------------------------------ ->>> Run 2: workload scale = 200 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 200 iterations -============================================= - -2025-09-11T00:34:33+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4000.23 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.14, 1.09, 0.90 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 4149 ns 4149 ns 171540 -StdFuncCall::noReturn 4078 ns 4078 ns 173142 -ReflectedCall::noReturn 4163 ns 4162 ns 172296 - -StdFuncMethodCall::noReturn 4164 ns 4163 ns 171601 -ReflectedMethodCall::noReturn 4206 ns 4206 ns 167024 --------------------------------------------------------------------------- -DirectCall::withReturn 4803 ns 4802 ns 146401 -StdFuncCall::withReturn 4767 ns 4766 ns 146265 -ReflectedCall::withReturn 4813 ns 4813 ns 144824 - -StdFuncMethodCall::withReturn 4797 ns 4797 ns 144938 -ReflectedMethodCall::withReturn 4842 ns 4841 ns 143714 ------------------------------------ ->>> Run 3: workload scale = 200 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 200 iterations -============================================= - -2025-09-11T00:34:45+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3428.64 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.20, 1.11, 0.90 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 4051 ns 4050 ns 169785 -StdFuncCall::noReturn 4060 ns 4060 ns 171288 -ReflectedCall::noReturn 4069 ns 4067 ns 171269 - -StdFuncMethodCall::noReturn 4037 ns 4036 ns 171130 -ReflectedMethodCall::noReturn 4070 ns 4069 ns 170385 --------------------------------------------------------------------------- -DirectCall::withReturn 4715 ns 4714 ns 147560 -StdFuncCall::withReturn 4710 ns 4710 ns 147903 -ReflectedCall::withReturn 4732 ns 4730 ns 146870 - -StdFuncMethodCall::withReturn 4706 ns 4705 ns 147200 -ReflectedMethodCall::withReturn 4743 ns 4741 ns 146280 ------------------------------------ ->>> Run 4: workload scale = 200 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 200 iterations -============================================= - -2025-09-11T00:34:56+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3097.37 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.15, 1.10, 0.91 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 4049 ns 4048 ns 172698 -StdFuncCall::noReturn 4028 ns 4028 ns 172826 -ReflectedCall::noReturn 4020 ns 4019 ns 172895 - -StdFuncMethodCall::noReturn 4011 ns 4010 ns 173064 -ReflectedMethodCall::noReturn 4022 ns 4022 ns 167520 --------------------------------------------------------------------------- -DirectCall::withReturn 4674 ns 4673 ns 149145 -StdFuncCall::withReturn 4664 ns 4663 ns 148506 -ReflectedCall::withReturn 4701 ns 4700 ns 148023 - -StdFuncMethodCall::withReturn 4671 ns 4670 ns 149320 -ReflectedMethodCall::withReturn 4706 ns 4706 ns 148082 ------------------------------------ ->>> Run 5: workload scale = 200 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 200 iterations -============================================= - -2025-09-11T00:35:08+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 1963.71 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.13, 1.10, 0.91 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 4035 ns 4035 ns 172990 -StdFuncCall::noReturn 4036 ns 4035 ns 169934 -ReflectedCall::noReturn 4037 ns 4035 ns 173552 - -StdFuncMethodCall::noReturn 4027 ns 4027 ns 173475 -ReflectedMethodCall::noReturn 4046 ns 4046 ns 172800 --------------------------------------------------------------------------- -DirectCall::withReturn 4683 ns 4682 ns 149053 -StdFuncCall::withReturn 4664 ns 4663 ns 148728 -ReflectedCall::withReturn 4695 ns 4694 ns 148659 - -StdFuncMethodCall::withReturn 4666 ns 4665 ns 148374 -ReflectedMethodCall::withReturn 4716 ns 4715 ns 147755 ------------------------------------ -All benchmarks completed. diff --git a/text-benchmark-logs/benchmark_returns_std_string.log b/text-benchmark-logs/benchmark_returns_std_string.log deleted file mode 100644 index 1a714ce3..00000000 --- a/text-benchmark-logs/benchmark_returns_std_string.log +++ /dev/null @@ -1,1655 +0,0 @@ -Starting benchmark runs... -Binary: ./bin/RTLBenchmarkApp -Log: ./benchmark_runs.log -=================================== ->>> Run 1: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:43:11+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4157.05 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 2.65, 1.34, 1.02 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2.69 ns 2.69 ns 257512106 -StdFuncCall::noReturn 3.78 ns 3.78 ns 191372055 -ReflectedCall::noReturn 4.75 ns 4.74 ns 150632849 - -StdFuncMethodCall::noReturn 3.37 ns 3.37 ns 205734218 -ReflectedMethodCall::noReturn 8.16 ns 8.15 ns 83185450 --------------------------------------------------------------------------- -DirectCall::withReturn 9.53 ns 9.52 ns 73618012 -StdFuncCall::withReturn 10.1 ns 10.1 ns 69035901 -ReflectedCall::withReturn 18.9 ns 18.9 ns 36880785 - -StdFuncMethodCall::withReturn 10.1 ns 10.1 ns 69220259 -ReflectedMethodCall::withReturn 22.1 ns 22.1 ns 31879199 ------------------------------------ ->>> Run 2: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:43:21+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2840.42 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 2.40, 1.33, 1.02 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2.68 ns 2.68 ns 260488715 -StdFuncCall::noReturn 3.62 ns 3.62 ns 200782884 -ReflectedCall::noReturn 4.56 ns 4.56 ns 148944703 - -StdFuncMethodCall::noReturn 3.39 ns 3.39 ns 208809945 -ReflectedMethodCall::noReturn 8.11 ns 8.10 ns 87050327 --------------------------------------------------------------------------- -DirectCall::withReturn 9.60 ns 9.60 ns 72996970 -StdFuncCall::withReturn 10.1 ns 10.1 ns 65628479 -ReflectedCall::withReturn 20.2 ns 20.2 ns 35013149 - -StdFuncMethodCall::withReturn 10.4 ns 10.4 ns 65866447 -ReflectedMethodCall::withReturn 23.0 ns 23.0 ns 30671071 ------------------------------------ ->>> Run 3: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:43:30+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4460.24 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 2.18, 1.32, 1.02 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2.87 ns 2.87 ns 241103915 -StdFuncCall::noReturn 3.82 ns 3.82 ns 196511816 -ReflectedCall::noReturn 4.81 ns 4.81 ns 146383768 - -StdFuncMethodCall::noReturn 3.44 ns 3.44 ns 203121679 -ReflectedMethodCall::noReturn 8.30 ns 8.29 ns 81544882 --------------------------------------------------------------------------- -DirectCall::withReturn 9.71 ns 9.70 ns 70716392 -StdFuncCall::withReturn 10.2 ns 10.2 ns 68308824 -ReflectedCall::withReturn 19.1 ns 19.1 ns 35574641 - -StdFuncMethodCall::withReturn 10.4 ns 10.4 ns 67503571 -ReflectedMethodCall::withReturn 22.1 ns 22.1 ns 31856370 ------------------------------------ ->>> Run 4: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:43:40+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3303.29 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 2.15, 1.34, 1.03 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2.78 ns 2.78 ns 244476044 -StdFuncCall::noReturn 3.51 ns 3.51 ns 186742133 -ReflectedCall::noReturn 4.72 ns 4.72 ns 145124302 - -StdFuncMethodCall::noReturn 3.71 ns 3.71 ns 195045272 -ReflectedMethodCall::noReturn 8.33 ns 8.32 ns 83825689 --------------------------------------------------------------------------- -DirectCall::withReturn 9.94 ns 9.94 ns 67349049 -StdFuncCall::withReturn 10.1 ns 10.1 ns 66482926 -ReflectedCall::withReturn 19.2 ns 19.2 ns 36102397 - -StdFuncMethodCall::withReturn 10.1 ns 10.1 ns 67142276 -ReflectedMethodCall::withReturn 22.8 ns 22.8 ns 29914325 ------------------------------------ ->>> Run 5: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:43:49+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 1457.53 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 2.21, 1.38, 1.05 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2.72 ns 2.72 ns 252082597 -StdFuncCall::noReturn 3.57 ns 3.57 ns 187629241 -ReflectedCall::noReturn 4.85 ns 4.85 ns 145919895 - -StdFuncMethodCall::noReturn 3.47 ns 3.47 ns 205701290 -ReflectedMethodCall::noReturn 8.19 ns 8.19 ns 82512348 --------------------------------------------------------------------------- -DirectCall::withReturn 9.82 ns 9.82 ns 68734745 -StdFuncCall::withReturn 10.2 ns 10.2 ns 66343231 -ReflectedCall::withReturn 19.1 ns 19.1 ns 36036806 - -StdFuncMethodCall::withReturn 10.1 ns 10.1 ns 66426936 -ReflectedMethodCall::withReturn 21.9 ns 21.9 ns 30764432 ------------------------------------ ->>> Run 6: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:43:59+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4134.64 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 2.10, 1.39, 1.05 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2.68 ns 2.68 ns 255151415 -StdFuncCall::noReturn 3.57 ns 3.57 ns 194877796 -ReflectedCall::noReturn 4.68 ns 4.68 ns 148012652 - -StdFuncMethodCall::noReturn 3.41 ns 3.41 ns 203119855 -ReflectedMethodCall::noReturn 8.27 ns 8.27 ns 84231855 --------------------------------------------------------------------------- -DirectCall::withReturn 9.91 ns 9.91 ns 67237407 -StdFuncCall::withReturn 10.1 ns 10.1 ns 66701430 -ReflectedCall::withReturn 19.0 ns 19.0 ns 35306832 - -StdFuncMethodCall::withReturn 10.1 ns 10.1 ns 66190294 -ReflectedMethodCall::withReturn 22.8 ns 22.8 ns 31433430 ------------------------------------ ->>> Run 7: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:44:08+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3065.25 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 2.01, 1.39, 1.06 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2.76 ns 2.75 ns 258152508 -StdFuncCall::noReturn 3.54 ns 3.54 ns 188663322 -ReflectedCall::noReturn 4.70 ns 4.70 ns 148190073 - -StdFuncMethodCall::noReturn 3.48 ns 3.48 ns 204262478 -ReflectedMethodCall::noReturn 8.15 ns 8.15 ns 82688841 --------------------------------------------------------------------------- -DirectCall::withReturn 9.71 ns 9.71 ns 70719451 -StdFuncCall::withReturn 10.2 ns 10.2 ns 66710422 -ReflectedCall::withReturn 19.2 ns 19.2 ns 35438621 - -StdFuncMethodCall::withReturn 10.1 ns 10.1 ns 64913832 -ReflectedMethodCall::withReturn 22.6 ns 22.5 ns 30465366 ------------------------------------ ->>> Run 8: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:44:17+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4152.63 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.85, 1.38, 1.06 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2.70 ns 2.70 ns 258092134 -StdFuncCall::noReturn 3.59 ns 3.59 ns 190138329 -ReflectedCall::noReturn 4.77 ns 4.77 ns 148249878 - -StdFuncMethodCall::noReturn 3.49 ns 3.49 ns 201288659 -ReflectedMethodCall::noReturn 8.16 ns 8.16 ns 81918693 --------------------------------------------------------------------------- -DirectCall::withReturn 9.91 ns 9.91 ns 70546801 -StdFuncCall::withReturn 10.2 ns 10.2 ns 65288578 -ReflectedCall::withReturn 18.9 ns 18.9 ns 35386904 - -StdFuncMethodCall::withReturn 10.2 ns 10.2 ns 66910973 -ReflectedMethodCall::withReturn 22.8 ns 22.8 ns 30535267 ------------------------------------ ->>> Run 9: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:44:27+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4236.18 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.88, 1.40, 1.07 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2.75 ns 2.75 ns 256627078 -StdFuncCall::noReturn 3.62 ns 3.62 ns 191604367 -ReflectedCall::noReturn 4.90 ns 4.90 ns 146177763 - -StdFuncMethodCall::noReturn 3.51 ns 3.51 ns 207243986 -ReflectedMethodCall::noReturn 8.34 ns 8.34 ns 85440083 --------------------------------------------------------------------------- -DirectCall::withReturn 9.71 ns 9.71 ns 70073783 -StdFuncCall::withReturn 10.3 ns 10.3 ns 64837520 -ReflectedCall::withReturn 19.2 ns 19.2 ns 36494857 - -StdFuncMethodCall::withReturn 10.2 ns 10.2 ns 64693494 -ReflectedMethodCall::withReturn 22.5 ns 22.5 ns 31231450 ------------------------------------ ->>> Run 10: workload scale = 0 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 0 iterations -============================================= - -2025-09-11T00:44:36+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3410.16 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.80, 1.39, 1.07 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3.18 ns 3.18 ns 220289404 -StdFuncCall::noReturn 3.68 ns 3.68 ns 185037995 -ReflectedCall::noReturn 4.95 ns 4.95 ns 138642595 - -StdFuncMethodCall::noReturn 3.69 ns 3.69 ns 191910140 -ReflectedMethodCall::noReturn 8.40 ns 8.40 ns 82408566 --------------------------------------------------------------------------- -DirectCall::withReturn 9.78 ns 9.78 ns 68512931 -StdFuncCall::withReturn 10.1 ns 10.1 ns 64820748 -ReflectedCall::withReturn 19.0 ns 19.0 ns 36083173 - -StdFuncMethodCall::withReturn 10.2 ns 10.2 ns 66179461 -ReflectedMethodCall::withReturn 22.4 ns 22.4 ns 31255435 ------------------------------------ ->>> Run 1: workload scale = 25 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 25 iterations -============================================= - -2025-09-11T00:44:45+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3869.61 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.76, 1.39, 1.07 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 310 ns 310 ns 2254101 -StdFuncCall::noReturn 315 ns 315 ns 2239763 -ReflectedCall::noReturn 316 ns 316 ns 2198780 - -StdFuncMethodCall::noReturn 313 ns 313 ns 2258100 -ReflectedMethodCall::noReturn 323 ns 323 ns 2166074 --------------------------------------------------------------------------- -DirectCall::withReturn 453 ns 453 ns 1577637 -StdFuncCall::withReturn 452 ns 452 ns 1575065 -ReflectedCall::withReturn 633 ns 633 ns 1064025 - -StdFuncMethodCall::withReturn 452 ns 451 ns 1575285 -ReflectedMethodCall::withReturn 640 ns 640 ns 1059786 ------------------------------------ ->>> Run 2: workload scale = 25 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 25 iterations -============================================= - -2025-09-11T00:44:56+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3794.29 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.72, 1.40, 1.08 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 317 ns 317 ns 2228177 -StdFuncCall::noReturn 308 ns 308 ns 2227891 -ReflectedCall::noReturn 318 ns 318 ns 2185558 - -StdFuncMethodCall::noReturn 320 ns 320 ns 2209955 -ReflectedMethodCall::noReturn 324 ns 324 ns 2131421 --------------------------------------------------------------------------- -DirectCall::withReturn 445 ns 445 ns 1580444 -StdFuncCall::withReturn 457 ns 457 ns 1550760 -ReflectedCall::withReturn 633 ns 633 ns 1077338 - -StdFuncMethodCall::withReturn 446 ns 446 ns 1563643 -ReflectedMethodCall::withReturn 646 ns 646 ns 1082286 ------------------------------------ ->>> Run 3: workload scale = 25 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 25 iterations -============================================= - -2025-09-11T00:45:06+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2203.19 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.77, 1.42, 1.09 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 312 ns 312 ns 2244981 -StdFuncCall::noReturn 308 ns 308 ns 2262484 -ReflectedCall::noReturn 318 ns 318 ns 2253123 - -StdFuncMethodCall::noReturn 312 ns 312 ns 2223455 -ReflectedMethodCall::noReturn 325 ns 325 ns 2208582 --------------------------------------------------------------------------- -DirectCall::withReturn 515 ns 515 ns 1315012 -StdFuncCall::withReturn 514 ns 514 ns 1314421 -ReflectedCall::withReturn 705 ns 705 ns 996799 - -StdFuncMethodCall::withReturn 518 ns 518 ns 1295521 -ReflectedMethodCall::withReturn 706 ns 706 ns 928961 ------------------------------------ ->>> Run 4: workload scale = 25 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 25 iterations -============================================= - -2025-09-11T00:45:15+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 1438.63 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.72, 1.42, 1.09 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 351 ns 351 ns 2035112 -StdFuncCall::noReturn 349 ns 349 ns 2030713 -ReflectedCall::noReturn 349 ns 349 ns 1980472 - -StdFuncMethodCall::noReturn 349 ns 349 ns 2023659 -ReflectedMethodCall::noReturn 353 ns 353 ns 1978482 --------------------------------------------------------------------------- -DirectCall::withReturn 510 ns 510 ns 1329271 -StdFuncCall::withReturn 513 ns 513 ns 1337409 -ReflectedCall::withReturn 712 ns 712 ns 931367 - -StdFuncMethodCall::withReturn 511 ns 511 ns 1279105 -ReflectedMethodCall::withReturn 711 ns 711 ns 980263 ------------------------------------ ->>> Run 5: workload scale = 25 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 25 iterations -============================================= - -2025-09-11T00:45:24+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3937.8 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.61, 1.41, 1.09 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 316 ns 316 ns 2233794 -StdFuncCall::noReturn 345 ns 345 ns 2026485 -ReflectedCall::noReturn 354 ns 354 ns 1979604 - -StdFuncMethodCall::noReturn 351 ns 351 ns 1987525 -ReflectedMethodCall::noReturn 363 ns 363 ns 1943031 --------------------------------------------------------------------------- -DirectCall::withReturn 523 ns 523 ns 1281177 -StdFuncCall::withReturn 522 ns 522 ns 1331638 -ReflectedCall::withReturn 702 ns 702 ns 971089 - -StdFuncMethodCall::withReturn 527 ns 527 ns 1342443 -ReflectedMethodCall::withReturn 707 ns 707 ns 966971 ------------------------------------ ->>> Run 1: workload scale = 50 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 50 iterations -============================================= - -2025-09-11T00:45:34+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3864.23 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.52, 1.39, 1.09 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 907 ns 906 ns 671085 -StdFuncCall::noReturn 913 ns 913 ns 750555 -ReflectedCall::noReturn 927 ns 927 ns 739691 - -StdFuncMethodCall::noReturn 913 ns 913 ns 734242 -ReflectedMethodCall::noReturn 938 ns 938 ns 722635 --------------------------------------------------------------------------- -DirectCall::withReturn 1246 ns 1246 ns 536846 -StdFuncCall::withReturn 1268 ns 1268 ns 546493 -ReflectedCall::withReturn 1595 ns 1595 ns 423002 - -StdFuncMethodCall::withReturn 1240 ns 1240 ns 548835 -ReflectedMethodCall::withReturn 1533 ns 1533 ns 444235 ------------------------------------ ->>> Run 2: workload scale = 50 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 50 iterations -============================================= - -2025-09-11T00:45:42+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4198.35 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.56, 1.40, 1.10 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 897 ns 897 ns 725976 -StdFuncCall::noReturn 907 ns 907 ns 753162 -ReflectedCall::noReturn 928 ns 927 ns 742010 - -StdFuncMethodCall::noReturn 919 ns 919 ns 716837 -ReflectedMethodCall::noReturn 939 ns 939 ns 713611 --------------------------------------------------------------------------- -DirectCall::withReturn 1199 ns 1199 ns 561452 -StdFuncCall::withReturn 1197 ns 1197 ns 560668 -ReflectedCall::withReturn 1530 ns 1529 ns 426508 - -StdFuncMethodCall::withReturn 1209 ns 1209 ns 556128 -ReflectedMethodCall::withReturn 1540 ns 1540 ns 434049 ------------------------------------ ->>> Run 3: workload scale = 50 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 50 iterations -============================================= - -2025-09-11T00:45:50+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3711.21 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.47, 1.39, 1.09 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 906 ns 906 ns 730770 -StdFuncCall::noReturn 904 ns 904 ns 752526 -ReflectedCall::noReturn 924 ns 924 ns 717981 - -StdFuncMethodCall::noReturn 899 ns 899 ns 738039 -ReflectedMethodCall::noReturn 923 ns 923 ns 726660 --------------------------------------------------------------------------- -DirectCall::withReturn 1172 ns 1172 ns 563431 -StdFuncCall::withReturn 1187 ns 1186 ns 559493 -ReflectedCall::withReturn 1525 ns 1525 ns 444023 - -StdFuncMethodCall::withReturn 1180 ns 1180 ns 564379 -ReflectedMethodCall::withReturn 1540 ns 1540 ns 444693 ------------------------------------ ->>> Run 4: workload scale = 50 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 50 iterations -============================================= - -2025-09-11T00:45:58+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4048.1 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.55, 1.41, 1.10 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 899 ns 899 ns 744944 -StdFuncCall::noReturn 905 ns 905 ns 755918 -ReflectedCall::noReturn 910 ns 910 ns 735203 - -StdFuncMethodCall::noReturn 910 ns 910 ns 751759 -ReflectedMethodCall::noReturn 927 ns 927 ns 718062 --------------------------------------------------------------------------- -DirectCall::withReturn 1193 ns 1192 ns 571996 -StdFuncCall::withReturn 1196 ns 1196 ns 551911 -ReflectedCall::withReturn 1509 ns 1509 ns 431152 - -StdFuncMethodCall::withReturn 1191 ns 1191 ns 546073 -ReflectedMethodCall::withReturn 1537 ns 1537 ns 441082 ------------------------------------ ->>> Run 5: workload scale = 50 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 50 iterations -============================================= - -2025-09-11T00:46:06+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 1023.61 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.51, 1.40, 1.10 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 916 ns 916 ns 732935 -StdFuncCall::noReturn 923 ns 923 ns 738825 -ReflectedCall::noReturn 920 ns 920 ns 716561 - -StdFuncMethodCall::noReturn 909 ns 909 ns 733723 -ReflectedMethodCall::noReturn 939 ns 939 ns 712708 --------------------------------------------------------------------------- -DirectCall::withReturn 1189 ns 1188 ns 567232 -StdFuncCall::withReturn 1190 ns 1190 ns 556865 -ReflectedCall::withReturn 1531 ns 1531 ns 454023 - -StdFuncMethodCall::withReturn 1187 ns 1187 ns 586934 -ReflectedMethodCall::withReturn 1536 ns 1536 ns 448828 ------------------------------------ ->>> Run 1: workload scale = 75 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 75 iterations -============================================= - -2025-09-11T00:46:14+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4506.7 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.51, 1.41, 1.11 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 1711 ns 1710 ns 397182 -StdFuncCall::noReturn 1701 ns 1701 ns 392625 -ReflectedCall::noReturn 1707 ns 1707 ns 404729 - -StdFuncMethodCall::noReturn 1708 ns 1708 ns 400940 -ReflectedMethodCall::noReturn 1745 ns 1744 ns 393836 --------------------------------------------------------------------------- -DirectCall::withReturn 2360 ns 2360 ns 296471 -StdFuncCall::withReturn 2358 ns 2358 ns 293315 -ReflectedCall::withReturn 3057 ns 3057 ns 229041 - -StdFuncMethodCall::withReturn 2355 ns 2354 ns 296620 -ReflectedMethodCall::withReturn 3034 ns 3034 ns 227950 ------------------------------------ ->>> Run 2: workload scale = 75 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 75 iterations -============================================= - -2025-09-11T00:46:23+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 1536.93 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.51, 1.41, 1.11 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 1746 ns 1746 ns 395262 -StdFuncCall::noReturn 1734 ns 1733 ns 403023 -ReflectedCall::noReturn 1752 ns 1752 ns 380243 - -StdFuncMethodCall::noReturn 1753 ns 1753 ns 388427 -ReflectedMethodCall::noReturn 1752 ns 1751 ns 388074 --------------------------------------------------------------------------- -DirectCall::withReturn 2395 ns 2395 ns 289058 -StdFuncCall::withReturn 2433 ns 2433 ns 286696 -ReflectedCall::withReturn 3164 ns 3164 ns 221492 - -StdFuncMethodCall::withReturn 2440 ns 2440 ns 281890 -ReflectedMethodCall::withReturn 3166 ns 3166 ns 221117 ------------------------------------ ->>> Run 3: workload scale = 75 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 75 iterations -============================================= - -2025-09-11T00:46:32+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3018.84 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.43, 1.40, 1.11 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 1741 ns 1741 ns 377462 -StdFuncCall::noReturn 1715 ns 1715 ns 398238 -ReflectedCall::noReturn 1722 ns 1721 ns 395238 - -StdFuncMethodCall::noReturn 1740 ns 1740 ns 391977 -ReflectedMethodCall::noReturn 1709 ns 1709 ns 391583 --------------------------------------------------------------------------- -DirectCall::withReturn 2301 ns 2301 ns 303807 -StdFuncCall::withReturn 2312 ns 2311 ns 300175 -ReflectedCall::withReturn 3073 ns 3073 ns 226573 - -StdFuncMethodCall::withReturn 2423 ns 2423 ns 290465 -ReflectedMethodCall::withReturn 3169 ns 3169 ns 224297 ------------------------------------ ->>> Run 4: workload scale = 75 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 75 iterations -============================================= - -2025-09-11T00:46:42+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3748.07 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.56, 1.42, 1.12 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 1762 ns 1762 ns 388500 -StdFuncCall::noReturn 1755 ns 1754 ns 387350 -ReflectedCall::noReturn 1753 ns 1753 ns 380083 - -StdFuncMethodCall::noReturn 1750 ns 1750 ns 393882 -ReflectedMethodCall::noReturn 1776 ns 1776 ns 391549 --------------------------------------------------------------------------- -DirectCall::withReturn 2401 ns 2400 ns 295056 -StdFuncCall::withReturn 2397 ns 2397 ns 295309 -ReflectedCall::withReturn 3079 ns 3079 ns 222199 - -StdFuncMethodCall::withReturn 2409 ns 2409 ns 282929 -ReflectedMethodCall::withReturn 3179 ns 3179 ns 223918 ------------------------------------ ->>> Run 5: workload scale = 75 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 75 iterations -============================================= - -2025-09-11T00:46:51+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 1163.73 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.63, 1.44, 1.13 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 1723 ns 1722 ns 384064 -StdFuncCall::noReturn 1737 ns 1737 ns 391656 -ReflectedCall::noReturn 1731 ns 1730 ns 386459 - -StdFuncMethodCall::noReturn 1733 ns 1733 ns 397046 -ReflectedMethodCall::noReturn 1737 ns 1737 ns 395967 --------------------------------------------------------------------------- -DirectCall::withReturn 2369 ns 2369 ns 291883 -StdFuncCall::withReturn 2372 ns 2371 ns 291833 -ReflectedCall::withReturn 3078 ns 3078 ns 228938 - -StdFuncMethodCall::withReturn 2363 ns 2363 ns 291230 -ReflectedMethodCall::withReturn 3115 ns 3115 ns 224035 ------------------------------------ ->>> Run 1: workload scale = 100 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 100 iterations -============================================= - -2025-09-11T00:47:01+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4500 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.60, 1.44, 1.13 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 1980 ns 1979 ns 351441 -StdFuncCall::noReturn 1949 ns 1949 ns 354766 -ReflectedCall::noReturn 1986 ns 1986 ns 347476 - -StdFuncMethodCall::noReturn 1961 ns 1960 ns 344503 -ReflectedMethodCall::noReturn 1994 ns 1993 ns 343757 --------------------------------------------------------------------------- -DirectCall::withReturn 3012 ns 3011 ns 236164 -StdFuncCall::withReturn 2976 ns 2976 ns 235449 -ReflectedCall::withReturn 3916 ns 3916 ns 184109 - -StdFuncMethodCall::withReturn 3026 ns 3026 ns 229148 -ReflectedMethodCall::withReturn 3878 ns 3878 ns 181123 ------------------------------------ ->>> Run 2: workload scale = 100 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 100 iterations -============================================= - -2025-09-11T00:47:11+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3869.01 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.59, 1.45, 1.14 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 1973 ns 1973 ns 343831 -StdFuncCall::noReturn 1967 ns 1966 ns 336873 -ReflectedCall::noReturn 1989 ns 1989 ns 348169 - -StdFuncMethodCall::noReturn 1988 ns 1988 ns 348304 -ReflectedMethodCall::noReturn 2012 ns 2012 ns 335265 --------------------------------------------------------------------------- -DirectCall::withReturn 3000 ns 3000 ns 230973 -StdFuncCall::withReturn 2967 ns 2966 ns 232757 -ReflectedCall::withReturn 3876 ns 3876 ns 183695 - -StdFuncMethodCall::withReturn 3027 ns 3027 ns 232206 -ReflectedMethodCall::withReturn 3816 ns 3815 ns 182478 ------------------------------------ ->>> Run 3: workload scale = 100 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 100 iterations -============================================= - -2025-09-11T00:47:20+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4509.87 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.58, 1.45, 1.14 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 1987 ns 1987 ns 344531 -StdFuncCall::noReturn 1974 ns 1974 ns 339319 -ReflectedCall::noReturn 1991 ns 1990 ns 341989 - -StdFuncMethodCall::noReturn 1991 ns 1991 ns 345119 -ReflectedMethodCall::noReturn 1994 ns 1993 ns 350809 --------------------------------------------------------------------------- -DirectCall::withReturn 3024 ns 3023 ns 236080 -StdFuncCall::withReturn 2991 ns 2990 ns 234932 -ReflectedCall::withReturn 3841 ns 3841 ns 182164 - -StdFuncMethodCall::withReturn 2949 ns 2948 ns 237674 -ReflectedMethodCall::withReturn 3890 ns 3890 ns 180491 ------------------------------------ ->>> Run 4: workload scale = 100 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 100 iterations -============================================= - -2025-09-11T00:47:30+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2443.13 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.57, 1.45, 1.14 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 1974 ns 1974 ns 347223 -StdFuncCall::noReturn 1973 ns 1972 ns 348490 -ReflectedCall::noReturn 1994 ns 1994 ns 345264 - -StdFuncMethodCall::noReturn 1940 ns 1939 ns 343663 -ReflectedMethodCall::noReturn 2003 ns 2003 ns 348942 --------------------------------------------------------------------------- -DirectCall::withReturn 2965 ns 2965 ns 237170 -StdFuncCall::withReturn 2913 ns 2913 ns 238241 -ReflectedCall::withReturn 3852 ns 3852 ns 184604 - -StdFuncMethodCall::withReturn 2915 ns 2915 ns 237691 -ReflectedMethodCall::withReturn 3782 ns 3782 ns 185705 ------------------------------------ ->>> Run 5: workload scale = 100 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 100 iterations -============================================= - -2025-09-11T00:47:40+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4409.93 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.56, 1.45, 1.15 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 1982 ns 1982 ns 351034 -StdFuncCall::noReturn 1964 ns 1964 ns 341721 -ReflectedCall::noReturn 1989 ns 1988 ns 350068 - -StdFuncMethodCall::noReturn 1955 ns 1954 ns 348141 -ReflectedMethodCall::noReturn 2003 ns 2003 ns 342525 --------------------------------------------------------------------------- -DirectCall::withReturn 2953 ns 2953 ns 234331 -StdFuncCall::withReturn 2934 ns 2934 ns 238160 -ReflectedCall::withReturn 3811 ns 3810 ns 186625 - -StdFuncMethodCall::withReturn 2912 ns 2912 ns 236835 -ReflectedMethodCall::withReturn 3899 ns 3898 ns 184770 ------------------------------------ ->>> Run 1: workload scale = 125 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 125 iterations -============================================= - -2025-09-11T00:47:50+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4575.95 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.63, 1.47, 1.16 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2187 ns 2187 ns 313314 -StdFuncCall::noReturn 2203 ns 2202 ns 310954 -ReflectedCall::noReturn 2231 ns 2231 ns 314343 - -StdFuncMethodCall::noReturn 2218 ns 2217 ns 308543 -ReflectedMethodCall::noReturn 2262 ns 2262 ns 307479 --------------------------------------------------------------------------- -DirectCall::withReturn 3654 ns 3654 ns 191381 -StdFuncCall::withReturn 3651 ns 3650 ns 193595 -ReflectedCall::withReturn 4748 ns 4747 ns 151401 - -StdFuncMethodCall::withReturn 3605 ns 3605 ns 194245 -ReflectedMethodCall::withReturn 4691 ns 4690 ns 152913 ------------------------------------ ->>> Run 2: workload scale = 125 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 125 iterations -============================================= - -2025-09-11T00:48:01+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4523.6 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.69, 1.49, 1.17 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2236 ns 2236 ns 309724 -StdFuncCall::noReturn 2214 ns 2214 ns 315329 -ReflectedCall::noReturn 2236 ns 2236 ns 309095 - -StdFuncMethodCall::noReturn 2217 ns 2217 ns 304364 -ReflectedMethodCall::noReturn 2247 ns 2247 ns 313155 --------------------------------------------------------------------------- -DirectCall::withReturn 3592 ns 3592 ns 195293 -StdFuncCall::withReturn 3587 ns 3587 ns 194462 -ReflectedCall::withReturn 4691 ns 4691 ns 152353 - -StdFuncMethodCall::withReturn 3594 ns 3594 ns 196395 -ReflectedMethodCall::withReturn 4737 ns 4737 ns 151845 ------------------------------------ ->>> Run 3: workload scale = 125 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 125 iterations -============================================= - -2025-09-11T00:48:11+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 799.56 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.73, 1.50, 1.18 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2237 ns 2237 ns 301530 -StdFuncCall::noReturn 2248 ns 2248 ns 305381 -ReflectedCall::noReturn 2234 ns 2233 ns 307334 - -StdFuncMethodCall::noReturn 2250 ns 2249 ns 289243 -ReflectedMethodCall::noReturn 2241 ns 2241 ns 308428 --------------------------------------------------------------------------- -DirectCall::withReturn 3685 ns 3684 ns 190114 -StdFuncCall::withReturn 3669 ns 3668 ns 190878 -ReflectedCall::withReturn 4782 ns 4782 ns 150076 - -StdFuncMethodCall::withReturn 3606 ns 3606 ns 191373 -ReflectedMethodCall::withReturn 4723 ns 4722 ns 152622 ------------------------------------ ->>> Run 4: workload scale = 125 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 125 iterations -============================================= - -2025-09-11T00:48:22+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2959.43 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.77, 1.52, 1.19 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2182 ns 2182 ns 307571 -StdFuncCall::noReturn 2184 ns 2183 ns 313459 -ReflectedCall::noReturn 2205 ns 2205 ns 317597 - -StdFuncMethodCall::noReturn 2224 ns 2223 ns 310829 -ReflectedMethodCall::noReturn 2235 ns 2235 ns 303977 --------------------------------------------------------------------------- -DirectCall::withReturn 3643 ns 3642 ns 195401 -StdFuncCall::withReturn 3554 ns 3554 ns 196445 -ReflectedCall::withReturn 4606 ns 4605 ns 154556 - -StdFuncMethodCall::withReturn 3581 ns 3581 ns 195507 -ReflectedMethodCall::withReturn 4713 ns 4713 ns 152328 ------------------------------------ ->>> Run 5: workload scale = 125 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 125 iterations -============================================= - -2025-09-11T00:48:32+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3933.71 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.90, 1.56, 1.20 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 2204 ns 2204 ns 305118 -StdFuncCall::noReturn 2204 ns 2204 ns 319369 -ReflectedCall::noReturn 2209 ns 2208 ns 314425 - -StdFuncMethodCall::noReturn 2226 ns 2226 ns 305314 -ReflectedMethodCall::noReturn 2220 ns 2220 ns 310974 --------------------------------------------------------------------------- -DirectCall::withReturn 3649 ns 3648 ns 195704 -StdFuncCall::withReturn 3665 ns 3664 ns 193630 -ReflectedCall::withReturn 4598 ns 4598 ns 152357 - -StdFuncMethodCall::withReturn 3629 ns 3628 ns 195927 -ReflectedMethodCall::withReturn 4805 ns 4805 ns 154283 ------------------------------------ ->>> Run 1: workload scale = 150 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 150 iterations -============================================= - -2025-09-11T00:48:43+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2671.41 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.92, 1.58, 1.21 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3533 ns 3533 ns 195180 -StdFuncCall::noReturn 3546 ns 3545 ns 195924 -ReflectedCall::noReturn 3625 ns 3625 ns 195820 - -StdFuncMethodCall::noReturn 3629 ns 3629 ns 197819 -ReflectedMethodCall::noReturn 3626 ns 3626 ns 195755 --------------------------------------------------------------------------- -DirectCall::withReturn 5182 ns 5181 ns 131107 -StdFuncCall::withReturn 5141 ns 5140 ns 130322 -ReflectedCall::withReturn 6380 ns 6380 ns 107050 - -StdFuncMethodCall::withReturn 5139 ns 5137 ns 130221 -ReflectedMethodCall::withReturn 6283 ns 6283 ns 109882 ------------------------------------ ->>> Run 2: workload scale = 150 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 150 iterations -============================================= - -2025-09-11T00:48:52+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 1153.89 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.92, 1.58, 1.22 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3645 ns 3644 ns 194763 -StdFuncCall::noReturn 3536 ns 3536 ns 197643 -ReflectedCall::noReturn 3549 ns 3549 ns 197667 - -StdFuncMethodCall::noReturn 3535 ns 3534 ns 197002 -ReflectedMethodCall::noReturn 3554 ns 3553 ns 196119 --------------------------------------------------------------------------- -DirectCall::withReturn 5181 ns 5181 ns 135659 -StdFuncCall::withReturn 5179 ns 5178 ns 133046 -ReflectedCall::withReturn 6373 ns 6371 ns 109310 - -StdFuncMethodCall::withReturn 5177 ns 5176 ns 132606 -ReflectedMethodCall::withReturn 6372 ns 6372 ns 109258 ------------------------------------ ->>> Run 3: workload scale = 150 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 150 iterations -============================================= - -2025-09-11T00:49:01+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 800 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.93, 1.60, 1.23 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3528 ns 3528 ns 197592 -StdFuncCall::noReturn 3510 ns 3510 ns 191078 -ReflectedCall::noReturn 3526 ns 3526 ns 197562 - -StdFuncMethodCall::noReturn 3514 ns 3513 ns 198411 -ReflectedMethodCall::noReturn 3730 ns 3730 ns 196892 --------------------------------------------------------------------------- -DirectCall::withReturn 5354 ns 5352 ns 123800 -StdFuncCall::withReturn 5245 ns 5244 ns 136768 -ReflectedCall::withReturn 6398 ns 6397 ns 106337 - -StdFuncMethodCall::withReturn 5175 ns 5175 ns 131618 -ReflectedMethodCall::withReturn 6289 ns 6287 ns 110758 ------------------------------------ ->>> Run 4: workload scale = 150 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 150 iterations -============================================= - -2025-09-11T00:49:10+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2161.83 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.87, 1.59, 1.23 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3542 ns 3541 ns 198073 -StdFuncCall::noReturn 3610 ns 3609 ns 195386 -ReflectedCall::noReturn 3583 ns 3582 ns 195941 - -StdFuncMethodCall::noReturn 3507 ns 3506 ns 199751 -ReflectedMethodCall::noReturn 3609 ns 3608 ns 195357 --------------------------------------------------------------------------- -DirectCall::withReturn 5074 ns 5073 ns 137709 -StdFuncCall::withReturn 5121 ns 5120 ns 136175 -ReflectedCall::withReturn 6347 ns 6346 ns 107908 - -StdFuncMethodCall::withReturn 5089 ns 5088 ns 132717 -ReflectedMethodCall::withReturn 6358 ns 6358 ns 111927 ------------------------------------ ->>> Run 5: workload scale = 150 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 150 iterations -============================================= - -2025-09-11T00:49:20+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 1932.44 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.73, 1.57, 1.23 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3578 ns 3577 ns 198985 -StdFuncCall::noReturn 3533 ns 3532 ns 198881 -ReflectedCall::noReturn 3517 ns 3517 ns 198702 - -StdFuncMethodCall::noReturn 3572 ns 3572 ns 198500 -ReflectedMethodCall::noReturn 3572 ns 3572 ns 185939 --------------------------------------------------------------------------- -DirectCall::withReturn 5046 ns 5046 ns 137950 -StdFuncCall::withReturn 5080 ns 5078 ns 138211 -ReflectedCall::withReturn 6306 ns 6304 ns 110192 - -StdFuncMethodCall::withReturn 5132 ns 5132 ns 131855 -ReflectedMethodCall::withReturn 6343 ns 6343 ns 107271 ------------------------------------ ->>> Run 1: workload scale = 175 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 175 iterations -============================================= - -2025-09-11T00:49:29+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2271.38 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.62, 1.55, 1.22 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3789 ns 3788 ns 183993 -StdFuncCall::noReturn 3777 ns 3776 ns 185241 -ReflectedCall::noReturn 3781 ns 3780 ns 183887 - -StdFuncMethodCall::noReturn 3778 ns 3777 ns 185194 -ReflectedMethodCall::noReturn 3815 ns 3814 ns 183316 --------------------------------------------------------------------------- -DirectCall::withReturn 5771 ns 5770 ns 121611 -StdFuncCall::withReturn 5735 ns 5734 ns 117886 -ReflectedCall::withReturn 7182 ns 7182 ns 94871 - -StdFuncMethodCall::withReturn 5796 ns 5795 ns 116975 -ReflectedMethodCall::withReturn 7194 ns 7193 ns 94083 ------------------------------------ ->>> Run 2: workload scale = 175 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 175 iterations -============================================= - -2025-09-11T00:49:38+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2817.81 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.52, 1.54, 1.22 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3877 ns 3877 ns 180661 -StdFuncCall::noReturn 3876 ns 3876 ns 181752 -ReflectedCall::noReturn 3864 ns 3864 ns 180348 - -StdFuncMethodCall::noReturn 3914 ns 3914 ns 180868 -ReflectedMethodCall::noReturn 3853 ns 3853 ns 179813 --------------------------------------------------------------------------- -DirectCall::withReturn 5826 ns 5826 ns 120405 -StdFuncCall::withReturn 5768 ns 5768 ns 120615 -ReflectedCall::withReturn 7147 ns 7147 ns 97322 - -StdFuncMethodCall::withReturn 5783 ns 5783 ns 120537 -ReflectedMethodCall::withReturn 7177 ns 7176 ns 96515 ------------------------------------ ->>> Run 3: workload scale = 175 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 175 iterations -============================================= - -2025-09-11T00:49:48+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2468.99 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.44, 1.52, 1.22 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3867 ns 3866 ns 184722 -StdFuncCall::noReturn 3813 ns 3813 ns 182052 -ReflectedCall::noReturn 3799 ns 3799 ns 183532 - -StdFuncMethodCall::noReturn 3901 ns 3901 ns 180895 -ReflectedMethodCall::noReturn 3821 ns 3820 ns 180911 --------------------------------------------------------------------------- -DirectCall::withReturn 5694 ns 5694 ns 122739 -StdFuncCall::withReturn 5726 ns 5726 ns 122179 -ReflectedCall::withReturn 7126 ns 7125 ns 99356 - -StdFuncMethodCall::withReturn 5669 ns 5669 ns 120489 -ReflectedMethodCall::withReturn 7014 ns 7013 ns 94851 ------------------------------------ ->>> Run 4: workload scale = 175 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 175 iterations -============================================= - -2025-09-11T00:49:57+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 800 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.37, 1.50, 1.21 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3811 ns 3811 ns 185570 -StdFuncCall::noReturn 4045 ns 4045 ns 173991 -ReflectedCall::noReturn 3913 ns 3913 ns 178008 - -StdFuncMethodCall::noReturn 3858 ns 3858 ns 180877 -ReflectedMethodCall::noReturn 3897 ns 3897 ns 181085 --------------------------------------------------------------------------- -DirectCall::withReturn 5706 ns 5706 ns 118455 -StdFuncCall::withReturn 5694 ns 5693 ns 119512 -ReflectedCall::withReturn 7093 ns 7093 ns 95014 - -StdFuncMethodCall::withReturn 5716 ns 5715 ns 117328 -ReflectedMethodCall::withReturn 7107 ns 7107 ns 92531 ------------------------------------ ->>> Run 5: workload scale = 175 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 175 iterations -============================================= - -2025-09-11T00:50:07+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 2389.7 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.34, 1.49, 1.21 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 3823 ns 3822 ns 184164 -StdFuncCall::noReturn 3921 ns 3920 ns 184054 -ReflectedCall::noReturn 3892 ns 3892 ns 181641 - -StdFuncMethodCall::noReturn 3917 ns 3917 ns 182002 -ReflectedMethodCall::noReturn 3937 ns 3937 ns 179719 --------------------------------------------------------------------------- -DirectCall::withReturn 5706 ns 5706 ns 116926 -StdFuncCall::withReturn 5727 ns 5726 ns 122669 -ReflectedCall::withReturn 7154 ns 7153 ns 92948 - -StdFuncMethodCall::withReturn 5696 ns 5695 ns 117101 -ReflectedMethodCall::withReturn 7157 ns 7157 ns 94837 ------------------------------------ ->>> Run 1: workload scale = 200 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 200 iterations -============================================= - -2025-09-11T00:50:16+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3209.87 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.37, 1.49, 1.22 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 4196 ns 4196 ns 170841 -StdFuncCall::noReturn 4197 ns 4197 ns 171474 -ReflectedCall::noReturn 4213 ns 4213 ns 167685 - -StdFuncMethodCall::noReturn 4195 ns 4195 ns 169093 -ReflectedMethodCall::noReturn 4235 ns 4235 ns 167817 --------------------------------------------------------------------------- -DirectCall::withReturn 6403 ns 6401 ns 105705 -StdFuncCall::withReturn 6411 ns 6409 ns 104979 -ReflectedCall::withReturn 7984 ns 7982 ns 83508 - -StdFuncMethodCall::withReturn 6531 ns 6529 ns 106182 -ReflectedMethodCall::withReturn 7987 ns 7986 ns 83759 ------------------------------------ ->>> Run 2: workload scale = 200 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 200 iterations -============================================= - -2025-09-11T00:50:26+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4359.42 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.47, 1.51, 1.22 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 4189 ns 4188 ns 170733 -StdFuncCall::noReturn 4075 ns 4073 ns 173783 -ReflectedCall::noReturn 4062 ns 4062 ns 172155 - -StdFuncMethodCall::noReturn 4036 ns 4036 ns 172871 -ReflectedMethodCall::noReturn 4156 ns 4156 ns 171048 --------------------------------------------------------------------------- -DirectCall::withReturn 6255 ns 6255 ns 107881 -StdFuncCall::withReturn 6202 ns 6201 ns 111269 -ReflectedCall::withReturn 7732 ns 7731 ns 88927 - -StdFuncMethodCall::withReturn 6237 ns 6237 ns 108573 -ReflectedMethodCall::withReturn 7717 ns 7716 ns 87408 ------------------------------------ ->>> Run 3: workload scale = 200 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 200 iterations -============================================= - -2025-09-11T00:50:35+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3349.71 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.47, 1.51, 1.23 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 4183 ns 4182 ns 172969 -StdFuncCall::noReturn 4158 ns 4158 ns 169661 -ReflectedCall::noReturn 4320 ns 4320 ns 167031 - -StdFuncMethodCall::noReturn 4142 ns 4142 ns 171242 -ReflectedMethodCall::noReturn 4244 ns 4243 ns 167943 --------------------------------------------------------------------------- -DirectCall::withReturn 6215 ns 6214 ns 107561 -StdFuncCall::withReturn 6285 ns 6284 ns 106520 -ReflectedCall::withReturn 7794 ns 7794 ns 86470 - -StdFuncMethodCall::withReturn 6259 ns 6257 ns 109244 -ReflectedMethodCall::withReturn 7877 ns 7876 ns 83397 ------------------------------------ ->>> Run 4: workload scale = 200 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 200 iterations -============================================= - -2025-09-11T00:50:45+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 4518.55 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.56, 1.52, 1.24 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 4097 ns 4097 ns 172402 -StdFuncCall::noReturn 4102 ns 4102 ns 171446 -ReflectedCall::noReturn 4218 ns 4217 ns 171091 - -StdFuncMethodCall::noReturn 4080 ns 4080 ns 170058 -ReflectedMethodCall::noReturn 4114 ns 4114 ns 170617 --------------------------------------------------------------------------- -DirectCall::withReturn 6368 ns 6367 ns 109122 -StdFuncCall::withReturn 6411 ns 6410 ns 104101 -ReflectedCall::withReturn 8033 ns 8032 ns 86564 - -StdFuncMethodCall::withReturn 6449 ns 6448 ns 103769 -ReflectedMethodCall::withReturn 8047 ns 8047 ns 82650 ------------------------------------ ->>> Run 5: workload scale = 200 - -======== RTL Benchmark Configuration ======== -Workload: concatenate string of length 500 -Scale : 200 iterations -============================================= - -2025-09-11T00:50:55+05:30 -Running ./bin/RTLBenchmarkApp -Run on (16 X 3507.94 MHz CPU s) -CPU Caches: - L1 Data 48 KiB (x8) - L1 Instruction 32 KiB (x8) - L2 Unified 1280 KiB (x8) - L3 Unified 20480 KiB (x1) -Load Average: 1.55, 1.52, 1.24 --------------------------------------------------------------------------- -Benchmark Time CPU Iterations --------------------------------------------------------------------------- -DirectCall::noReturn 4065 ns 4065 ns 171561 -StdFuncCall::noReturn 4084 ns 4084 ns 174097 -ReflectedCall::noReturn 4206 ns 4205 ns 172296 - -StdFuncMethodCall::noReturn 4229 ns 4229 ns 173534 -ReflectedMethodCall::noReturn 4068 ns 4068 ns 171180 --------------------------------------------------------------------------- -DirectCall::withReturn 6278 ns 6277 ns 111032 -StdFuncCall::withReturn 6352 ns 6351 ns 106040 -ReflectedCall::withReturn 7900 ns 7898 ns 87218 - -StdFuncMethodCall::withReturn 6349 ns 6349 ns 110877 -ReflectedMethodCall::withReturn 7880 ns 7878 ns 84629 ------------------------------------ -All benchmarks completed. diff --git a/text-benchmark-logs/benchmark_runs_string.log b/text-benchmark-logs/benchmark_runs_string.log new file mode 100644 index 00000000..8411fb33 --- /dev/null +++ b/text-benchmark-logs/benchmark_runs_string.log @@ -0,0 +1,3167 @@ +Starting benchmark runs... +Binary: ./bin/RTLBenchmarkApp +Log: ./benchmark_runs.log +=================================== +[2025-11-04 12:16:26] >>> Run 1: workload scale = 0 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 0 iterations +============================================= + +2025-11-04T12:16:26+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 3710.04 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 0.72, 1.01, 0.81 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 10.7 ns 10.7 ns 63153409 + +bm_call::via_function_ptr__Function::set_string 11.0 ns 11.0 ns 62273630 +bm_call::via_function_ptr____Method::set_string 11.1 ns 11.1 ns 62565849 + +bm_std::function_calls__Function::set_string 11.3 ns 11.3 ns 60820859 +bm_std::function_calls____Method::set_string 11.3 ns 11.2 ns 62223001 + +bm_rtl::function_calls__Function::set_string 11.8 ns 11.8 ns 62334625 +bm_rtl::method_calls______Method::set_string 11.7 ns 11.7 ns 58038245 + +bm_rtl::function__ErasedReturnType::set_string 13.6 ns 13.6 ns 51307142 +bm_rtl::method____ErasedReturnType::set_string 14.5 ns 14.5 ns 49013292 +bm_rtl::method____ErasedTargetType::set_string 14.4 ns 14.4 ns 48282886 +bm_rtl::method____ErasedTargetAndReturnType::set_string 14.3 ns 14.3 ns 48290341 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 12.3 ns 12.3 ns 56910624 + +bm_call::via_function_ptr__Function::get_string 13.3 ns 13.3 ns 54725237 +bm_call::via_function_ptr____Method::get_string 13.5 ns 13.5 ns 51174087 + +bm_std::function_calls__Function::get_string 13.4 ns 13.4 ns 51284624 +bm_std::function_calls____Method::get_string 13.4 ns 13.4 ns 53332275 + +bm_rtl::function_calls__Function::get_string 12.9 ns 12.9 ns 51676343 +bm_rtl::method_calls______Method::get_string 13.0 ns 13.0 ns 53310944 + +bm_rtl::function__ErasedReturnType::get_string 33.5 ns 33.5 ns 21875285 +bm_rtl::method____ErasedReturnType::get_string 33.8 ns 33.8 ns 20417210 +bm_rtl::method____ErasedTargetType::get_string 23.0 ns 23.0 ns 31547854 +bm_rtl::method____ErasedTargetAndReturnType::get_string 34.6 ns 34.6 ns 20062476 +----------------------------------- +[2025-11-04 12:16:45] >>> Run 2: workload scale = 0 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 0 iterations +============================================= + +2025-11-04T12:16:45+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 3859.55 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.03, 1.06, 0.83 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 10.8 ns 10.8 ns 59543169 + +bm_call::via_function_ptr__Function::set_string 11.3 ns 11.3 ns 63603473 +bm_call::via_function_ptr____Method::set_string 11.4 ns 11.4 ns 60018727 + +bm_std::function_calls__Function::set_string 11.6 ns 11.6 ns 61482058 +bm_std::function_calls____Method::set_string 11.4 ns 11.4 ns 60456156 + +bm_rtl::function_calls__Function::set_string 11.2 ns 11.2 ns 62862118 +bm_rtl::method_calls______Method::set_string 11.8 ns 11.8 ns 58169006 + +bm_rtl::function__ErasedReturnType::set_string 13.8 ns 13.8 ns 49964913 +bm_rtl::method____ErasedReturnType::set_string 14.1 ns 14.1 ns 49075849 +bm_rtl::method____ErasedTargetType::set_string 14.7 ns 14.7 ns 47435229 +bm_rtl::method____ErasedTargetAndReturnType::set_string 14.4 ns 14.4 ns 48401256 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 12.7 ns 12.7 ns 54462134 + +bm_call::via_function_ptr__Function::get_string 12.9 ns 12.9 ns 55248821 +bm_call::via_function_ptr____Method::get_string 12.9 ns 12.9 ns 54718885 + +bm_std::function_calls__Function::get_string 13.0 ns 13.0 ns 53924949 +bm_std::function_calls____Method::get_string 12.9 ns 12.9 ns 53432887 + +bm_rtl::function_calls__Function::get_string 12.6 ns 12.6 ns 55170671 +bm_rtl::method_calls______Method::get_string 12.8 ns 12.8 ns 54845579 + +bm_rtl::function__ErasedReturnType::get_string 31.9 ns 31.8 ns 21982235 +bm_rtl::method____ErasedReturnType::get_string 32.3 ns 32.3 ns 21861314 +bm_rtl::method____ErasedTargetType::get_string 21.5 ns 21.5 ns 32708463 +bm_rtl::method____ErasedTargetAndReturnType::get_string 32.9 ns 32.9 ns 21076858 +----------------------------------- +[2025-11-04 12:17:05] >>> Run 3: workload scale = 0 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 0 iterations +============================================= + +2025-11-04T12:17:05+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.02, 1.05, 0.83 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 10.6 ns 10.6 ns 64487293 + +bm_call::via_function_ptr__Function::set_string 10.9 ns 10.9 ns 64347447 +bm_call::via_function_ptr____Method::set_string 10.9 ns 10.9 ns 63847988 + +bm_std::function_calls__Function::set_string 11.2 ns 11.2 ns 61218687 +bm_std::function_calls____Method::set_string 11.3 ns 11.3 ns 61153450 + +bm_rtl::function_calls__Function::set_string 11.1 ns 11.1 ns 61892878 +bm_rtl::method_calls______Method::set_string 11.3 ns 11.3 ns 61658245 + +bm_rtl::function__ErasedReturnType::set_string 13.3 ns 13.3 ns 52552206 +bm_rtl::method____ErasedReturnType::set_string 13.9 ns 13.9 ns 50430274 +bm_rtl::method____ErasedTargetType::set_string 14.4 ns 14.4 ns 47389596 +bm_rtl::method____ErasedTargetAndReturnType::set_string 14.7 ns 14.7 ns 47109221 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 12.6 ns 12.6 ns 55992884 + +bm_call::via_function_ptr__Function::get_string 12.9 ns 12.9 ns 51161238 +bm_call::via_function_ptr____Method::get_string 12.9 ns 12.9 ns 55017241 + +bm_std::function_calls__Function::get_string 13.5 ns 13.5 ns 53286324 +bm_std::function_calls____Method::get_string 13.3 ns 13.3 ns 52908638 + +bm_rtl::function_calls__Function::get_string 12.6 ns 12.6 ns 54243132 +bm_rtl::method_calls______Method::get_string 13.2 ns 13.2 ns 54944142 + +bm_rtl::function__ErasedReturnType::get_string 33.1 ns 33.1 ns 20589263 +bm_rtl::method____ErasedReturnType::get_string 32.9 ns 32.9 ns 21653434 +bm_rtl::method____ErasedTargetType::get_string 23.6 ns 23.6 ns 32185719 +bm_rtl::method____ErasedTargetAndReturnType::get_string 34.2 ns 34.2 ns 20567080 +----------------------------------- +[2025-11-04 12:17:24] >>> Run 4: workload scale = 0 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 0 iterations +============================================= + +2025-11-04T12:17:24+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 4288.87 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.09, 1.07, 0.84 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 11.1 ns 11.1 ns 66290824 + +bm_call::via_function_ptr__Function::set_string 11.0 ns 11.0 ns 60341873 +bm_call::via_function_ptr____Method::set_string 11.6 ns 11.6 ns 61663734 + +bm_std::function_calls__Function::set_string 11.6 ns 11.6 ns 62238534 +bm_std::function_calls____Method::set_string 11.4 ns 11.4 ns 62096594 + +bm_rtl::function_calls__Function::set_string 11.3 ns 11.3 ns 61460234 +bm_rtl::method_calls______Method::set_string 11.6 ns 11.6 ns 60712083 + +bm_rtl::function__ErasedReturnType::set_string 13.3 ns 13.3 ns 52213654 +bm_rtl::method____ErasedReturnType::set_string 14.2 ns 14.2 ns 48504898 +bm_rtl::method____ErasedTargetType::set_string 14.7 ns 14.7 ns 47578516 +bm_rtl::method____ErasedTargetAndReturnType::set_string 14.7 ns 14.7 ns 48196113 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 12.4 ns 12.4 ns 56590796 + +bm_call::via_function_ptr__Function::get_string 12.7 ns 12.7 ns 55116932 +bm_call::via_function_ptr____Method::get_string 12.8 ns 12.8 ns 53240632 + +bm_std::function_calls__Function::get_string 13.0 ns 13.0 ns 52948776 +bm_std::function_calls____Method::get_string 12.9 ns 12.9 ns 54392848 + +bm_rtl::function_calls__Function::get_string 12.6 ns 12.6 ns 55104443 +bm_rtl::method_calls______Method::get_string 12.7 ns 12.7 ns 54425465 + +bm_rtl::function__ErasedReturnType::get_string 31.6 ns 31.6 ns 22273160 +bm_rtl::method____ErasedReturnType::get_string 32.1 ns 32.1 ns 21839814 +bm_rtl::method____ErasedTargetType::get_string 22.2 ns 22.2 ns 31167600 +bm_rtl::method____ErasedTargetAndReturnType::get_string 32.7 ns 32.7 ns 21437578 +----------------------------------- +[2025-11-04 12:17:43] >>> Run 5: workload scale = 0 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 0 iterations +============================================= + +2025-11-04T12:17:43+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 2364.75 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.13, 1.08, 0.85 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 10.6 ns 10.6 ns 65062380 + +bm_call::via_function_ptr__Function::set_string 10.8 ns 10.8 ns 64248959 +bm_call::via_function_ptr____Method::set_string 11.0 ns 11.0 ns 62551535 + +bm_std::function_calls__Function::set_string 11.2 ns 11.2 ns 60406745 +bm_std::function_calls____Method::set_string 11.3 ns 11.3 ns 62448796 + +bm_rtl::function_calls__Function::set_string 11.2 ns 11.2 ns 62675614 +bm_rtl::method_calls______Method::set_string 11.3 ns 11.3 ns 61733399 + +bm_rtl::function__ErasedReturnType::set_string 13.3 ns 13.3 ns 52161573 +bm_rtl::method____ErasedReturnType::set_string 14.3 ns 14.3 ns 48854344 +bm_rtl::method____ErasedTargetType::set_string 14.5 ns 14.5 ns 47526683 +bm_rtl::method____ErasedTargetAndReturnType::set_string 14.4 ns 14.4 ns 48356248 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 12.4 ns 12.4 ns 57334137 + +bm_call::via_function_ptr__Function::get_string 12.7 ns 12.7 ns 54933363 +bm_call::via_function_ptr____Method::get_string 12.8 ns 12.8 ns 53994926 + +bm_std::function_calls__Function::get_string 12.9 ns 12.9 ns 53790025 +bm_std::function_calls____Method::get_string 12.9 ns 12.9 ns 54509865 + +bm_rtl::function_calls__Function::get_string 12.6 ns 12.6 ns 55782606 +bm_rtl::method_calls______Method::get_string 12.8 ns 12.8 ns 54696995 + +bm_rtl::function__ErasedReturnType::get_string 31.7 ns 31.7 ns 22095198 +bm_rtl::method____ErasedReturnType::get_string 32.4 ns 32.3 ns 21713225 +bm_rtl::method____ErasedTargetType::get_string 22.2 ns 22.2 ns 31569734 +bm_rtl::method____ErasedTargetAndReturnType::get_string 33.1 ns 33.1 ns 21257867 +----------------------------------- +[2025-11-04 12:18:02] >>> Run 1: workload scale = 1 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 1 iterations +============================================= + +2025-11-04T12:18:02+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 2640.13 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.09, 1.07, 0.85 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 24.9 ns 24.9 ns 28022770 + +bm_call::via_function_ptr__Function::set_string 25.9 ns 25.9 ns 26967330 +bm_call::via_function_ptr____Method::set_string 25.9 ns 25.9 ns 27132859 + +bm_std::function_calls__Function::set_string 26.4 ns 26.4 ns 26707120 +bm_std::function_calls____Method::set_string 27.0 ns 27.0 ns 25364124 + +bm_rtl::function_calls__Function::set_string 26.5 ns 26.5 ns 26552439 +bm_rtl::method_calls______Method::set_string 26.6 ns 26.6 ns 26210950 + +bm_rtl::function__ErasedReturnType::set_string 28.3 ns 28.3 ns 24736980 +bm_rtl::method____ErasedReturnType::set_string 30.2 ns 30.2 ns 23375542 +bm_rtl::method____ErasedTargetType::set_string 30.6 ns 30.6 ns 22925732 +bm_rtl::method____ErasedTargetAndReturnType::set_string 30.2 ns 30.2 ns 23200080 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 48.3 ns 48.3 ns 15089307 + +bm_call::via_function_ptr__Function::get_string 46.2 ns 46.2 ns 14395666 +bm_call::via_function_ptr____Method::get_string 46.4 ns 46.4 ns 15068891 + +bm_std::function_calls__Function::get_string 47.4 ns 47.4 ns 14709171 +bm_std::function_calls____Method::get_string 47.0 ns 47.0 ns 14929156 + +bm_rtl::function_calls__Function::get_string 47.2 ns 47.2 ns 14911798 +bm_rtl::method_calls______Method::get_string 47.4 ns 47.3 ns 14890050 + +bm_rtl::function__ErasedReturnType::get_string 73.3 ns 73.3 ns 9416841 +bm_rtl::method____ErasedReturnType::get_string 74.4 ns 74.4 ns 9461511 +bm_rtl::method____ErasedTargetType::get_string 51.9 ns 51.8 ns 13545805 +bm_rtl::method____ErasedTargetAndReturnType::get_string 76.1 ns 76.1 ns 9115088 +----------------------------------- +[2025-11-04 12:18:25] >>> Run 2: workload scale = 1 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 1 iterations +============================================= + +2025-11-04T12:18:25+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 3955.49 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.19, 1.10, 0.87 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 26.2 ns 26.2 ns 27125007 + +bm_call::via_function_ptr__Function::set_string 27.0 ns 27.0 ns 25958094 +bm_call::via_function_ptr____Method::set_string 27.6 ns 27.6 ns 25196375 + +bm_std::function_calls__Function::set_string 26.5 ns 26.5 ns 25360125 +bm_std::function_calls____Method::set_string 26.9 ns 26.9 ns 26002489 + +bm_rtl::function_calls__Function::set_string 27.6 ns 27.6 ns 26475578 +bm_rtl::method_calls______Method::set_string 27.4 ns 27.4 ns 26001742 + +bm_rtl::function__ErasedReturnType::set_string 29.0 ns 29.0 ns 24504219 +bm_rtl::method____ErasedReturnType::set_string 30.8 ns 30.8 ns 22220233 +bm_rtl::method____ErasedTargetType::set_string 32.1 ns 32.1 ns 22030367 +bm_rtl::method____ErasedTargetAndReturnType::set_string 31.5 ns 31.5 ns 21595468 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 48.9 ns 48.9 ns 14300718 + +bm_call::via_function_ptr__Function::get_string 47.1 ns 47.0 ns 14990892 +bm_call::via_function_ptr____Method::get_string 50.2 ns 50.2 ns 12790209 + +bm_std::function_calls__Function::get_string 51.9 ns 51.9 ns 13535943 +bm_std::function_calls____Method::get_string 51.0 ns 51.0 ns 13266104 + +bm_rtl::function_calls__Function::get_string 52.0 ns 52.0 ns 13086597 +bm_rtl::method_calls______Method::get_string 52.3 ns 52.3 ns 13161774 + +bm_rtl::function__ErasedReturnType::get_string 75.2 ns 75.1 ns 9107436 +bm_rtl::method____ErasedReturnType::get_string 75.1 ns 75.1 ns 9267100 +bm_rtl::method____ErasedTargetType::get_string 55.1 ns 55.1 ns 12320961 +bm_rtl::method____ErasedTargetAndReturnType::get_string 75.8 ns 75.8 ns 8943782 +----------------------------------- +[2025-11-04 12:18:45] >>> Run 3: workload scale = 1 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 1 iterations +============================================= + +2025-11-04T12:18:45+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 3021.55 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.42, 1.16, 0.89 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 25.8 ns 25.8 ns 26976208 + +bm_call::via_function_ptr__Function::set_string 26.2 ns 26.2 ns 26667714 +bm_call::via_function_ptr____Method::set_string 25.9 ns 25.9 ns 26622049 + +bm_std::function_calls__Function::set_string 26.5 ns 26.5 ns 26580719 +bm_std::function_calls____Method::set_string 26.5 ns 26.5 ns 26123278 + +bm_rtl::function_calls__Function::set_string 26.5 ns 26.5 ns 26879045 +bm_rtl::method_calls______Method::set_string 26.9 ns 26.9 ns 25596201 + +bm_rtl::function__ErasedReturnType::set_string 28.5 ns 28.5 ns 24501028 +bm_rtl::method____ErasedReturnType::set_string 29.4 ns 29.4 ns 23746741 +bm_rtl::method____ErasedTargetType::set_string 30.3 ns 30.3 ns 23247708 +bm_rtl::method____ErasedTargetAndReturnType::set_string 29.8 ns 29.7 ns 23353452 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 50.2 ns 50.2 ns 13814456 + +bm_call::via_function_ptr__Function::get_string 50.3 ns 50.3 ns 13214574 +bm_call::via_function_ptr____Method::get_string 50.3 ns 50.3 ns 13867447 + +bm_std::function_calls__Function::get_string 51.4 ns 51.4 ns 13700559 +bm_std::function_calls____Method::get_string 50.8 ns 50.8 ns 12953501 + +bm_rtl::function_calls__Function::get_string 51.3 ns 51.2 ns 13527958 +bm_rtl::method_calls______Method::get_string 51.4 ns 51.4 ns 13420354 + +bm_rtl::function__ErasedReturnType::get_string 72.1 ns 72.1 ns 9577905 +bm_rtl::method____ErasedReturnType::get_string 73.4 ns 73.4 ns 9418802 +bm_rtl::method____ErasedTargetType::get_string 52.8 ns 52.8 ns 12881319 +bm_rtl::method____ErasedTargetAndReturnType::get_string 75.1 ns 75.1 ns 9268764 +----------------------------------- +[2025-11-04 12:19:05] >>> Run 1: workload scale = 5 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 5 iterations +============================================= + +2025-11-04T12:19:05+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 1832.76 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.51, 1.19, 0.91 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 109 ns 109 ns 6356905 + +bm_call::via_function_ptr__Function::set_string 110 ns 110 ns 6362958 +bm_call::via_function_ptr____Method::set_string 110 ns 110 ns 6337180 + +bm_std::function_calls__Function::set_string 112 ns 112 ns 6271505 +bm_std::function_calls____Method::set_string 111 ns 111 ns 6267824 + +bm_rtl::function_calls__Function::set_string 111 ns 111 ns 6287188 +bm_rtl::method_calls______Method::set_string 111 ns 111 ns 6263824 + +bm_rtl::function__ErasedReturnType::set_string 114 ns 114 ns 6107867 +bm_rtl::method____ErasedReturnType::set_string 114 ns 114 ns 6126524 +bm_rtl::method____ErasedTargetType::set_string 115 ns 115 ns 6078615 +bm_rtl::method____ErasedTargetAndReturnType::set_string 114 ns 114 ns 6060333 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 211 ns 211 ns 3302773 + +bm_call::via_function_ptr__Function::get_string 212 ns 212 ns 3300130 +bm_call::via_function_ptr____Method::get_string 213 ns 213 ns 3269215 + +bm_std::function_calls__Function::get_string 212 ns 212 ns 3289700 +bm_std::function_calls____Method::get_string 212 ns 212 ns 3283718 + +bm_rtl::function_calls__Function::get_string 213 ns 213 ns 3282782 +bm_rtl::method_calls______Method::get_string 214 ns 214 ns 3260274 + +bm_rtl::function__ErasedReturnType::get_string 267 ns 267 ns 2625824 +bm_rtl::method____ErasedReturnType::get_string 268 ns 268 ns 2609629 +bm_rtl::method____ErasedTargetType::get_string 218 ns 218 ns 3204239 +bm_rtl::method____ErasedTargetAndReturnType::get_string 269 ns 269 ns 2603345 +----------------------------------- +[2025-11-04 12:19:24] >>> Run 2: workload scale = 5 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 5 iterations +============================================= + +2025-11-04T12:19:24+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 4801.49 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.40, 1.18, 0.92 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 110 ns 110 ns 6254342 + +bm_call::via_function_ptr__Function::set_string 111 ns 111 ns 6127808 +bm_call::via_function_ptr____Method::set_string 110 ns 110 ns 6215491 + +bm_std::function_calls__Function::set_string 112 ns 112 ns 6194003 +bm_std::function_calls____Method::set_string 112 ns 112 ns 6253000 + +bm_rtl::function_calls__Function::set_string 111 ns 111 ns 6277966 +bm_rtl::method_calls______Method::set_string 110 ns 110 ns 6335238 + +bm_rtl::function__ErasedReturnType::set_string 113 ns 113 ns 6173358 +bm_rtl::method____ErasedReturnType::set_string 113 ns 113 ns 6189036 +bm_rtl::method____ErasedTargetType::set_string 114 ns 114 ns 6088778 +bm_rtl::method____ErasedTargetAndReturnType::set_string 114 ns 114 ns 6097107 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 190 ns 190 ns 3679128 + +bm_call::via_function_ptr__Function::get_string 190 ns 190 ns 3672961 +bm_call::via_function_ptr____Method::get_string 190 ns 190 ns 3680081 + +bm_std::function_calls__Function::get_string 189 ns 189 ns 3685674 +bm_std::function_calls____Method::get_string 189 ns 189 ns 3697261 + +bm_rtl::function_calls__Function::get_string 190 ns 190 ns 3690621 +bm_rtl::method_calls______Method::get_string 190 ns 190 ns 3685585 + +bm_rtl::function__ErasedReturnType::get_string 242 ns 242 ns 2896462 +bm_rtl::method____ErasedReturnType::get_string 240 ns 240 ns 2919692 +bm_rtl::method____ErasedTargetType::get_string 195 ns 195 ns 3598721 +bm_rtl::method____ErasedTargetAndReturnType::get_string 242 ns 242 ns 2896405 +----------------------------------- +[2025-11-04 12:19:44] >>> Run 3: workload scale = 5 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 5 iterations +============================================= + +2025-11-04T12:19:44+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 2019.39 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.28, 1.17, 0.92 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 109 ns 109 ns 6366490 + +bm_call::via_function_ptr__Function::set_string 110 ns 110 ns 6364151 +bm_call::via_function_ptr____Method::set_string 110 ns 110 ns 6358758 + +bm_std::function_calls__Function::set_string 111 ns 111 ns 6296215 +bm_std::function_calls____Method::set_string 111 ns 111 ns 6318768 + +bm_rtl::function_calls__Function::set_string 110 ns 110 ns 6318789 +bm_rtl::method_calls______Method::set_string 110 ns 110 ns 6326380 + +bm_rtl::function__ErasedReturnType::set_string 113 ns 113 ns 6147018 +bm_rtl::method____ErasedReturnType::set_string 113 ns 113 ns 6162989 +bm_rtl::method____ErasedTargetType::set_string 115 ns 115 ns 5940721 +bm_rtl::method____ErasedTargetAndReturnType::set_string 114 ns 114 ns 6084423 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 191 ns 191 ns 3678026 + +bm_call::via_function_ptr__Function::get_string 191 ns 191 ns 3666456 +bm_call::via_function_ptr____Method::get_string 191 ns 191 ns 3666182 + +bm_std::function_calls__Function::get_string 190 ns 190 ns 3676735 +bm_std::function_calls____Method::get_string 190 ns 190 ns 3679305 + +bm_rtl::function_calls__Function::get_string 191 ns 190 ns 3683024 +bm_rtl::method_calls______Method::get_string 191 ns 191 ns 3674662 + +bm_rtl::function__ErasedReturnType::get_string 242 ns 242 ns 2882786 +bm_rtl::method____ErasedReturnType::get_string 241 ns 241 ns 2911958 +bm_rtl::method____ErasedTargetType::get_string 196 ns 196 ns 3581200 +bm_rtl::method____ErasedTargetAndReturnType::get_string 243 ns 243 ns 2882409 +----------------------------------- +[2025-11-04 12:20:03] >>> Run 1: workload scale = 10 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 10 iterations +============================================= + +2025-11-04T12:20:03+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 3993.12 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.20, 1.16, 0.92 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 187 ns 187 ns 3726311 + +bm_call::via_function_ptr__Function::set_string 188 ns 188 ns 3744673 +bm_call::via_function_ptr____Method::set_string 188 ns 188 ns 3735227 + +bm_std::function_calls__Function::set_string 188 ns 188 ns 3718232 +bm_std::function_calls____Method::set_string 188 ns 188 ns 3712163 + +bm_rtl::function_calls__Function::set_string 188 ns 188 ns 3719395 +bm_rtl::method_calls______Method::set_string 188 ns 188 ns 3708975 + +bm_rtl::function__ErasedReturnType::set_string 192 ns 192 ns 3644143 +bm_rtl::method____ErasedReturnType::set_string 192 ns 192 ns 3646885 +bm_rtl::method____ErasedTargetType::set_string 193 ns 193 ns 3651118 +bm_rtl::method____ErasedTargetAndReturnType::set_string 194 ns 194 ns 3617474 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 358 ns 358 ns 1956467 + +bm_call::via_function_ptr__Function::get_string 349 ns 349 ns 2006340 +bm_call::via_function_ptr____Method::get_string 351 ns 351 ns 2002609 + +bm_std::function_calls__Function::get_string 348 ns 348 ns 2008102 +bm_std::function_calls____Method::get_string 349 ns 349 ns 2011577 + +bm_rtl::function_calls__Function::get_string 348 ns 348 ns 2010126 +bm_rtl::method_calls______Method::get_string 349 ns 349 ns 2004066 + +bm_rtl::function__ErasedReturnType::get_string 426 ns 426 ns 1643422 +bm_rtl::method____ErasedReturnType::get_string 430 ns 430 ns 1629089 +bm_rtl::method____ErasedTargetType::get_string 353 ns 353 ns 1979505 +bm_rtl::method____ErasedTargetAndReturnType::get_string 429 ns 428 ns 1635028 +----------------------------------- +[2025-11-04 12:20:25] >>> Run 2: workload scale = 10 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 10 iterations +============================================= + +2025-11-04T12:20:25+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 2840.4 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.13, 1.14, 0.92 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 177 ns 177 ns 3940952 + +bm_call::via_function_ptr__Function::set_string 178 ns 178 ns 3934929 +bm_call::via_function_ptr____Method::set_string 178 ns 178 ns 3932855 + +bm_std::function_calls__Function::set_string 179 ns 178 ns 3927235 +bm_std::function_calls____Method::set_string 183 ns 183 ns 3673773 + +bm_rtl::function_calls__Function::set_string 180 ns 180 ns 3868708 +bm_rtl::method_calls______Method::set_string 180 ns 180 ns 3907622 + +bm_rtl::function__ErasedReturnType::set_string 183 ns 183 ns 3861068 +bm_rtl::method____ErasedReturnType::set_string 180 ns 180 ns 3885727 +bm_rtl::method____ErasedTargetType::set_string 183 ns 183 ns 3796810 +bm_rtl::method____ErasedTargetAndReturnType::set_string 183 ns 183 ns 3820688 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 319 ns 319 ns 2203411 + +bm_call::via_function_ptr__Function::get_string 310 ns 310 ns 2263612 +bm_call::via_function_ptr____Method::get_string 312 ns 312 ns 2254295 + +bm_std::function_calls__Function::get_string 311 ns 311 ns 2247231 +bm_std::function_calls____Method::get_string 310 ns 310 ns 2274352 + +bm_rtl::function_calls__Function::get_string 314 ns 314 ns 2259091 +bm_rtl::method_calls______Method::get_string 315 ns 315 ns 2266882 + +bm_rtl::function__ErasedReturnType::get_string 381 ns 381 ns 1843706 +bm_rtl::method____ErasedReturnType::get_string 382 ns 382 ns 1846973 +bm_rtl::method____ErasedTargetType::get_string 316 ns 316 ns 2213949 +bm_rtl::method____ErasedTargetAndReturnType::get_string 381 ns 381 ns 1843965 +----------------------------------- +[2025-11-04 12:20:47] >>> Run 3: workload scale = 10 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 10 iterations +============================================= + +2025-11-04T12:20:47+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 2572.05 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.25, 1.17, 0.93 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 178 ns 178 ns 3900950 + +bm_call::via_function_ptr__Function::set_string 180 ns 180 ns 3879189 +bm_call::via_function_ptr____Method::set_string 179 ns 179 ns 3834422 + +bm_std::function_calls__Function::set_string 179 ns 179 ns 3920381 +bm_std::function_calls____Method::set_string 180 ns 180 ns 3891620 + +bm_rtl::function_calls__Function::set_string 181 ns 181 ns 3872767 +bm_rtl::method_calls______Method::set_string 180 ns 180 ns 3910455 + +bm_rtl::function__ErasedReturnType::set_string 182 ns 182 ns 3832558 +bm_rtl::method____ErasedReturnType::set_string 181 ns 181 ns 3885287 +bm_rtl::method____ErasedTargetType::set_string 185 ns 185 ns 3776004 +bm_rtl::method____ErasedTargetAndReturnType::set_string 183 ns 183 ns 3823404 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 320 ns 320 ns 2191852 + +bm_call::via_function_ptr__Function::get_string 311 ns 311 ns 2255298 +bm_call::via_function_ptr____Method::get_string 314 ns 314 ns 2234056 + +bm_std::function_calls__Function::get_string 313 ns 313 ns 2230322 +bm_std::function_calls____Method::get_string 313 ns 313 ns 2216167 + +bm_rtl::function_calls__Function::get_string 355 ns 355 ns 2009288 +bm_rtl::method_calls______Method::get_string 323 ns 323 ns 1912946 + +bm_rtl::function__ErasedReturnType::get_string 384 ns 384 ns 1824265 +bm_rtl::method____ErasedReturnType::get_string 384 ns 384 ns 1808329 +bm_rtl::method____ErasedTargetType::get_string 321 ns 321 ns 2143924 +bm_rtl::method____ErasedTargetAndReturnType::get_string 385 ns 385 ns 1808807 +----------------------------------- +[2025-11-04 12:21:09] >>> Run 1: workload scale = 15 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 15 iterations +============================================= + +2025-11-04T12:21:09+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 4900 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.18, 1.16, 0.94 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 208 ns 208 ns 3354887 + +bm_call::via_function_ptr__Function::set_string 209 ns 209 ns 3348189 +bm_call::via_function_ptr____Method::set_string 214 ns 214 ns 3338144 + +bm_std::function_calls__Function::set_string 210 ns 210 ns 3356079 +bm_std::function_calls____Method::set_string 209 ns 209 ns 3352077 + +bm_rtl::function_calls__Function::set_string 211 ns 211 ns 3317584 +bm_rtl::method_calls______Method::set_string 209 ns 209 ns 3338550 + +bm_rtl::function__ErasedReturnType::set_string 212 ns 212 ns 3325113 +bm_rtl::method____ErasedReturnType::set_string 216 ns 216 ns 3217407 +bm_rtl::method____ErasedTargetType::set_string 212 ns 212 ns 3296378 +bm_rtl::method____ErasedTargetAndReturnType::set_string 210 ns 210 ns 3347149 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 383 ns 383 ns 1835016 + +bm_call::via_function_ptr__Function::get_string 381 ns 381 ns 1842308 +bm_call::via_function_ptr____Method::get_string 383 ns 383 ns 1831574 + +bm_std::function_calls__Function::get_string 395 ns 395 ns 1761881 +bm_std::function_calls____Method::get_string 387 ns 387 ns 1804570 + +bm_rtl::function_calls__Function::get_string 383 ns 383 ns 1817991 +bm_rtl::method_calls______Method::get_string 385 ns 385 ns 1823692 + +bm_rtl::function__ErasedReturnType::get_string 461 ns 461 ns 1524833 +bm_rtl::method____ErasedReturnType::get_string 463 ns 463 ns 1511457 +bm_rtl::method____ErasedTargetType::get_string 390 ns 390 ns 1795845 +bm_rtl::method____ErasedTargetAndReturnType::get_string 462 ns 462 ns 1515668 +----------------------------------- +[2025-11-04 12:21:31] >>> Run 2: workload scale = 15 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 15 iterations +============================================= + +2025-11-04T12:21:31+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 3073.18 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.19, 1.16, 0.94 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 210 ns 210 ns 3340652 + +bm_call::via_function_ptr__Function::set_string 211 ns 211 ns 3324856 +bm_call::via_function_ptr____Method::set_string 211 ns 211 ns 3310404 + +bm_std::function_calls__Function::set_string 212 ns 212 ns 3308725 +bm_std::function_calls____Method::set_string 212 ns 212 ns 3287037 + +bm_rtl::function_calls__Function::set_string 212 ns 212 ns 3314574 +bm_rtl::method_calls______Method::set_string 212 ns 212 ns 3283145 + +bm_rtl::function__ErasedReturnType::set_string 211 ns 211 ns 3341051 +bm_rtl::method____ErasedReturnType::set_string 214 ns 214 ns 3259385 +bm_rtl::method____ErasedTargetType::set_string 212 ns 212 ns 3304041 +bm_rtl::method____ErasedTargetAndReturnType::set_string 226 ns 226 ns 3085668 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 382 ns 382 ns 1626037 + +bm_call::via_function_ptr__Function::get_string 381 ns 381 ns 1835546 +bm_call::via_function_ptr____Method::get_string 383 ns 383 ns 1828808 + +bm_std::function_calls__Function::get_string 387 ns 387 ns 1822200 +bm_std::function_calls____Method::get_string 393 ns 393 ns 1800319 + +bm_rtl::function_calls__Function::get_string 386 ns 386 ns 1800817 +bm_rtl::method_calls______Method::get_string 384 ns 384 ns 1823455 + +bm_rtl::function__ErasedReturnType::get_string 462 ns 462 ns 1519511 +bm_rtl::method____ErasedReturnType::get_string 464 ns 464 ns 1504120 +bm_rtl::method____ErasedTargetType::get_string 393 ns 393 ns 1794253 +bm_rtl::method____ErasedTargetAndReturnType::get_string 462 ns 462 ns 1497097 +----------------------------------- +[2025-11-04 12:21:54] >>> Run 3: workload scale = 15 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 15 iterations +============================================= + +2025-11-04T12:21:54+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 2736.79 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.14, 1.15, 0.95 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 212 ns 212 ns 3300818 + +bm_call::via_function_ptr__Function::set_string 213 ns 213 ns 3277311 +bm_call::via_function_ptr____Method::set_string 212 ns 212 ns 3300103 + +bm_std::function_calls__Function::set_string 212 ns 212 ns 3272237 +bm_std::function_calls____Method::set_string 212 ns 212 ns 3299601 + +bm_rtl::function_calls__Function::set_string 219 ns 219 ns 3298106 +bm_rtl::method_calls______Method::set_string 217 ns 217 ns 3175023 + +bm_rtl::function__ErasedReturnType::set_string 228 ns 228 ns 3138094 +bm_rtl::method____ErasedReturnType::set_string 225 ns 225 ns 3093211 +bm_rtl::method____ErasedTargetType::set_string 222 ns 222 ns 3260985 +bm_rtl::method____ErasedTargetAndReturnType::set_string 225 ns 225 ns 3014027 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 409 ns 409 ns 1704362 + +bm_call::via_function_ptr__Function::get_string 400 ns 400 ns 1816140 +bm_call::via_function_ptr____Method::get_string 396 ns 396 ns 1710091 + +bm_std::function_calls__Function::get_string 396 ns 396 ns 1764724 +bm_std::function_calls____Method::get_string 413 ns 413 ns 1719759 + +bm_rtl::function_calls__Function::get_string 401 ns 401 ns 1722218 +bm_rtl::method_calls______Method::get_string 396 ns 395 ns 1730519 + +bm_rtl::function__ErasedReturnType::get_string 494 ns 494 ns 1440837 +bm_rtl::method____ErasedReturnType::get_string 475 ns 475 ns 1396097 +bm_rtl::method____ErasedTargetType::get_string 394 ns 394 ns 1749298 +bm_rtl::method____ErasedTargetAndReturnType::get_string 462 ns 462 ns 1464101 +----------------------------------- +[2025-11-04 12:22:17] >>> Run 1: workload scale = 20 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 20 iterations +============================================= + +2025-11-04T12:22:17+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 4443.83 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.39, 1.20, 0.97 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 300 ns 300 ns 2364526 + +bm_call::via_function_ptr__Function::set_string 308 ns 308 ns 2261139 +bm_call::via_function_ptr____Method::set_string 305 ns 305 ns 2314184 + +bm_std::function_calls__Function::set_string 304 ns 304 ns 2341024 +bm_std::function_calls____Method::set_string 289 ns 289 ns 2389222 + +bm_rtl::function_calls__Function::set_string 332 ns 332 ns 2175216 +bm_rtl::method_calls______Method::set_string 322 ns 322 ns 2088936 + +bm_rtl::function__ErasedReturnType::set_string 323 ns 322 ns 2146160 +bm_rtl::method____ErasedReturnType::set_string 333 ns 333 ns 2191564 +bm_rtl::method____ErasedTargetType::set_string 303 ns 303 ns 2332242 +bm_rtl::method____ErasedTargetAndReturnType::set_string 326 ns 326 ns 2345345 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 566 ns 566 ns 1251288 + +bm_call::via_function_ptr__Function::get_string 548 ns 548 ns 1233039 +bm_call::via_function_ptr____Method::get_string 540 ns 540 ns 1272200 + +bm_std::function_calls__Function::get_string 541 ns 541 ns 1268122 +bm_std::function_calls____Method::get_string 543 ns 543 ns 1234772 + +bm_rtl::function_calls__Function::get_string 543 ns 543 ns 1288268 +bm_rtl::method_calls______Method::get_string 546 ns 546 ns 1267151 + +bm_rtl::function__ErasedReturnType::get_string 659 ns 659 ns 1057558 +bm_rtl::method____ErasedReturnType::get_string 662 ns 662 ns 1022937 +bm_rtl::method____ErasedTargetType::get_string 562 ns 562 ns 1212939 +bm_rtl::method____ErasedTargetAndReturnType::get_string 666 ns 666 ns 1049185 +----------------------------------- +[2025-11-04 12:22:37] >>> Run 2: workload scale = 20 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 20 iterations +============================================= + +2025-11-04T12:22:37+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 1913.44 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.41, 1.22, 0.98 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 295 ns 295 ns 2334833 + +bm_call::via_function_ptr__Function::set_string 300 ns 300 ns 2352180 +bm_call::via_function_ptr____Method::set_string 301 ns 301 ns 2293720 + +bm_std::function_calls__Function::set_string 296 ns 296 ns 2395257 +bm_std::function_calls____Method::set_string 301 ns 301 ns 2276040 + +bm_rtl::function_calls__Function::set_string 297 ns 297 ns 2345901 +bm_rtl::method_calls______Method::set_string 296 ns 296 ns 2355417 + +bm_rtl::function__ErasedReturnType::set_string 295 ns 295 ns 2377750 +bm_rtl::method____ErasedReturnType::set_string 294 ns 294 ns 2351079 +bm_rtl::method____ErasedTargetType::set_string 295 ns 295 ns 2383689 +bm_rtl::method____ErasedTargetAndReturnType::set_string 296 ns 296 ns 2374165 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 536 ns 536 ns 1301506 + +bm_call::via_function_ptr__Function::get_string 535 ns 535 ns 1316754 +bm_call::via_function_ptr____Method::get_string 534 ns 534 ns 1293290 + +bm_std::function_calls__Function::get_string 537 ns 536 ns 1307063 +bm_std::function_calls____Method::get_string 540 ns 540 ns 1284540 + +bm_rtl::function_calls__Function::get_string 536 ns 536 ns 1287766 +bm_rtl::method_calls______Method::get_string 539 ns 539 ns 1301959 + +bm_rtl::function__ErasedReturnType::get_string 641 ns 641 ns 1085182 +bm_rtl::method____ErasedReturnType::get_string 645 ns 645 ns 1084685 +bm_rtl::method____ErasedTargetType::get_string 546 ns 546 ns 1273493 +bm_rtl::method____ErasedTargetAndReturnType::get_string 649 ns 649 ns 1072660 +----------------------------------- +[2025-11-04 12:22:57] >>> Run 3: workload scale = 20 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 20 iterations +============================================= + +2025-11-04T12:22:57+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 3817.78 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.29, 1.21, 0.98 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 288 ns 288 ns 2443622 + +bm_call::via_function_ptr__Function::set_string 291 ns 291 ns 2423578 +bm_call::via_function_ptr____Method::set_string 295 ns 295 ns 2407524 + +bm_std::function_calls__Function::set_string 294 ns 294 ns 2344270 +bm_std::function_calls____Method::set_string 291 ns 291 ns 2396174 + +bm_rtl::function_calls__Function::set_string 293 ns 293 ns 2412280 +bm_rtl::method_calls______Method::set_string 294 ns 294 ns 2426574 + +bm_rtl::function__ErasedReturnType::set_string 295 ns 295 ns 2377689 +bm_rtl::method____ErasedReturnType::set_string 293 ns 293 ns 2394389 +bm_rtl::method____ErasedTargetType::set_string 297 ns 297 ns 2344509 +bm_rtl::method____ErasedTargetAndReturnType::set_string 300 ns 300 ns 2352884 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 536 ns 536 ns 1295414 + +bm_call::via_function_ptr__Function::get_string 541 ns 541 ns 1233897 +bm_call::via_function_ptr____Method::get_string 541 ns 541 ns 1288959 + +bm_std::function_calls__Function::get_string 547 ns 547 ns 1262440 +bm_std::function_calls____Method::get_string 566 ns 566 ns 1227613 + +bm_rtl::function_calls__Function::get_string 548 ns 548 ns 1275405 +bm_rtl::method_calls______Method::get_string 548 ns 548 ns 1245585 + +bm_rtl::function__ErasedReturnType::get_string 653 ns 653 ns 1046627 +bm_rtl::method____ErasedReturnType::get_string 650 ns 650 ns 1059528 +bm_rtl::method____ErasedTargetType::get_string 552 ns 552 ns 1244640 +bm_rtl::method____ErasedTargetAndReturnType::get_string 654 ns 654 ns 1067972 +----------------------------------- +[2025-11-04 12:23:16] >>> Run 1: workload scale = 25 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 25 iterations +============================================= + +2025-11-04T12:23:16+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 2745.05 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.21, 1.19, 0.99 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 321 ns 321 ns 2145052 + +bm_call::via_function_ptr__Function::set_string 321 ns 321 ns 2172662 +bm_call::via_function_ptr____Method::set_string 320 ns 320 ns 2190165 + +bm_std::function_calls__Function::set_string 319 ns 319 ns 2215014 +bm_std::function_calls____Method::set_string 319 ns 319 ns 2192899 + +bm_rtl::function_calls__Function::set_string 326 ns 326 ns 2167253 +bm_rtl::method_calls______Method::set_string 323 ns 323 ns 2146891 + +bm_rtl::function__ErasedReturnType::set_string 331 ns 331 ns 2128543 +bm_rtl::method____ErasedReturnType::set_string 330 ns 330 ns 2161480 +bm_rtl::method____ErasedTargetType::set_string 329 ns 329 ns 2093144 +bm_rtl::method____ErasedTargetAndReturnType::set_string 328 ns 328 ns 2128289 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 669 ns 668 ns 937516 + +bm_call::via_function_ptr__Function::get_string 664 ns 664 ns 1042010 +bm_call::via_function_ptr____Method::get_string 666 ns 666 ns 1047814 + +bm_std::function_calls__Function::get_string 668 ns 668 ns 1021621 +bm_std::function_calls____Method::get_string 668 ns 668 ns 1017963 + +bm_rtl::function_calls__Function::get_string 669 ns 669 ns 1037708 +bm_rtl::method_calls______Method::get_string 665 ns 665 ns 1047174 + +bm_rtl::function__ErasedReturnType::get_string 793 ns 793 ns 883503 +bm_rtl::method____ErasedReturnType::get_string 795 ns 795 ns 871865 +bm_rtl::method____ErasedTargetType::get_string 680 ns 680 ns 1021801 +bm_rtl::method____ErasedTargetAndReturnType::get_string 801 ns 801 ns 874189 +----------------------------------- +[2025-11-04 12:23:37] >>> Run 2: workload scale = 25 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 25 iterations +============================================= + +2025-11-04T12:23:37+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 3126.6 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.22, 1.19, 0.99 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 320 ns 320 ns 2189231 + +bm_call::via_function_ptr__Function::set_string 342 ns 342 ns 2163509 +bm_call::via_function_ptr____Method::set_string 365 ns 365 ns 1916223 + +bm_std::function_calls__Function::set_string 361 ns 361 ns 1905923 +bm_std::function_calls____Method::set_string 356 ns 356 ns 1958867 + +bm_rtl::function_calls__Function::set_string 359 ns 359 ns 1907278 +bm_rtl::method_calls______Method::set_string 354 ns 354 ns 1909265 + +bm_rtl::function__ErasedReturnType::set_string 364 ns 363 ns 1935027 +bm_rtl::method____ErasedReturnType::set_string 360 ns 360 ns 1957560 +bm_rtl::method____ErasedTargetType::set_string 362 ns 362 ns 1941976 +bm_rtl::method____ErasedTargetAndReturnType::set_string 332 ns 332 ns 2099239 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 680 ns 680 ns 1030475 + +bm_call::via_function_ptr__Function::get_string 668 ns 667 ns 1005079 +bm_call::via_function_ptr____Method::get_string 668 ns 668 ns 1048120 + +bm_std::function_calls__Function::get_string 670 ns 670 ns 1049568 +bm_std::function_calls____Method::get_string 666 ns 666 ns 1053000 + +bm_rtl::function_calls__Function::get_string 665 ns 665 ns 1055481 +bm_rtl::method_calls______Method::get_string 665 ns 665 ns 1058130 + +bm_rtl::function__ErasedReturnType::get_string 788 ns 788 ns 887250 +bm_rtl::method____ErasedReturnType::get_string 793 ns 793 ns 890800 +bm_rtl::method____ErasedTargetType::get_string 698 ns 698 ns 1004244 +bm_rtl::method____ErasedTargetAndReturnType::get_string 794 ns 794 ns 884426 +----------------------------------- +[2025-11-04 12:23:57] >>> Run 3: workload scale = 25 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 25 iterations +============================================= + +2025-11-04T12:23:57+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800.525 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.44, 1.25, 1.02 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 318 ns 318 ns 2197752 + +bm_call::via_function_ptr__Function::set_string 322 ns 322 ns 2162163 +bm_call::via_function_ptr____Method::set_string 345 ns 345 ns 2174209 + +bm_std::function_calls__Function::set_string 354 ns 354 ns 1984909 +bm_std::function_calls____Method::set_string 353 ns 353 ns 1979871 + +bm_rtl::function_calls__Function::set_string 358 ns 357 ns 1969102 +bm_rtl::method_calls______Method::set_string 357 ns 357 ns 1963100 + +bm_rtl::function__ErasedReturnType::set_string 356 ns 356 ns 1956769 +bm_rtl::method____ErasedReturnType::set_string 359 ns 359 ns 1953417 +bm_rtl::method____ErasedTargetType::set_string 363 ns 363 ns 1961373 +bm_rtl::method____ErasedTargetAndReturnType::set_string 360 ns 360 ns 1947329 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 748 ns 748 ns 924341 + +bm_call::via_function_ptr__Function::get_string 747 ns 747 ns 925487 +bm_call::via_function_ptr____Method::get_string 746 ns 746 ns 928898 + +bm_std::function_calls__Function::get_string 749 ns 749 ns 925990 +bm_std::function_calls____Method::get_string 749 ns 749 ns 929901 + +bm_rtl::function_calls__Function::get_string 746 ns 746 ns 915844 +bm_rtl::method_calls______Method::get_string 750 ns 750 ns 928817 + +bm_rtl::function__ErasedReturnType::get_string 901 ns 901 ns 776868 +bm_rtl::method____ErasedReturnType::get_string 897 ns 897 ns 773498 +bm_rtl::method____ErasedTargetType::get_string 757 ns 757 ns 925383 +bm_rtl::method____ErasedTargetAndReturnType::get_string 897 ns 897 ns 778280 +----------------------------------- +[2025-11-04 12:24:18] >>> Run 1: workload scale = 30 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 30 iterations +============================================= + +2025-11-04T12:24:18+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 4153.56 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.32, 1.23, 1.01 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 374 ns 373 ns 1873476 + +bm_call::via_function_ptr__Function::set_string 376 ns 376 ns 1863509 +bm_call::via_function_ptr____Method::set_string 374 ns 374 ns 1863221 + +bm_std::function_calls__Function::set_string 373 ns 373 ns 1871738 +bm_std::function_calls____Method::set_string 376 ns 376 ns 1865547 + +bm_rtl::function_calls__Function::set_string 376 ns 376 ns 1865067 +bm_rtl::method_calls______Method::set_string 377 ns 377 ns 1858187 + +bm_rtl::function__ErasedReturnType::set_string 380 ns 380 ns 1837243 +bm_rtl::method____ErasedReturnType::set_string 386 ns 386 ns 1822783 +bm_rtl::method____ErasedTargetType::set_string 412 ns 412 ns 1701170 +bm_rtl::method____ErasedTargetAndReturnType::set_string 414 ns 413 ns 1700118 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 956 ns 956 ns 728821 + +bm_call::via_function_ptr__Function::get_string 956 ns 956 ns 729173 +bm_call::via_function_ptr____Method::get_string 955 ns 954 ns 732604 + +bm_std::function_calls__Function::get_string 963 ns 963 ns 720513 +bm_std::function_calls____Method::get_string 970 ns 970 ns 720651 + +bm_rtl::function_calls__Function::get_string 962 ns 962 ns 724222 +bm_rtl::method_calls______Method::get_string 964 ns 964 ns 720737 + +bm_rtl::function__ErasedReturnType::get_string 1167 ns 1166 ns 598228 +bm_rtl::method____ErasedReturnType::get_string 1177 ns 1177 ns 594646 +bm_rtl::method____ErasedTargetType::get_string 982 ns 982 ns 710920 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1181 ns 1181 ns 590085 +----------------------------------- +[2025-11-04 12:24:39] >>> Run 2: workload scale = 30 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 30 iterations +============================================= + +2025-11-04T12:24:39+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 2855.26 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.23, 1.22, 1.01 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 400 ns 400 ns 1746516 + +bm_call::via_function_ptr__Function::set_string 401 ns 401 ns 1746207 +bm_call::via_function_ptr____Method::set_string 401 ns 401 ns 1755755 + +bm_std::function_calls__Function::set_string 402 ns 402 ns 1742386 +bm_std::function_calls____Method::set_string 403 ns 403 ns 1743721 + +bm_rtl::function_calls__Function::set_string 406 ns 406 ns 1726824 +bm_rtl::method_calls______Method::set_string 401 ns 401 ns 1734713 + +bm_rtl::function__ErasedReturnType::set_string 408 ns 408 ns 1720118 +bm_rtl::method____ErasedReturnType::set_string 407 ns 407 ns 1718166 +bm_rtl::method____ErasedTargetType::set_string 410 ns 410 ns 1711945 +bm_rtl::method____ErasedTargetAndReturnType::set_string 381 ns 381 ns 1768747 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 881 ns 881 ns 787730 + +bm_call::via_function_ptr__Function::get_string 874 ns 874 ns 796785 +bm_call::via_function_ptr____Method::get_string 872 ns 872 ns 793060 + +bm_std::function_calls__Function::get_string 891 ns 890 ns 784802 +bm_std::function_calls____Method::get_string 889 ns 889 ns 780768 + +bm_rtl::function_calls__Function::get_string 883 ns 883 ns 789722 +bm_rtl::method_calls______Method::get_string 887 ns 887 ns 786262 + +bm_rtl::function__ErasedReturnType::get_string 1083 ns 1083 ns 643370 +bm_rtl::method____ErasedReturnType::get_string 1089 ns 1089 ns 643122 +bm_rtl::method____ErasedTargetType::get_string 912 ns 912 ns 752875 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1095 ns 1095 ns 640973 +----------------------------------- +[2025-11-04 12:25:01] >>> Run 3: workload scale = 30 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 30 iterations +============================================= + +2025-11-04T12:25:01+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 4282.06 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.15, 1.20, 1.01 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 374 ns 374 ns 1885971 + +bm_call::via_function_ptr__Function::set_string 375 ns 375 ns 1873368 +bm_call::via_function_ptr____Method::set_string 373 ns 373 ns 1868671 + +bm_std::function_calls__Function::set_string 377 ns 377 ns 1860537 +bm_std::function_calls____Method::set_string 378 ns 378 ns 1854349 + +bm_rtl::function_calls__Function::set_string 376 ns 376 ns 1861382 +bm_rtl::method_calls______Method::set_string 376 ns 376 ns 1858131 + +bm_rtl::function__ErasedReturnType::set_string 383 ns 383 ns 1839310 +bm_rtl::method____ErasedReturnType::set_string 383 ns 383 ns 1832865 +bm_rtl::method____ErasedTargetType::set_string 389 ns 389 ns 1823647 +bm_rtl::method____ErasedTargetAndReturnType::set_string 393 ns 393 ns 1743924 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 897 ns 897 ns 777617 + +bm_call::via_function_ptr__Function::get_string 891 ns 891 ns 792904 +bm_call::via_function_ptr____Method::get_string 883 ns 883 ns 752790 + +bm_std::function_calls__Function::get_string 897 ns 897 ns 769458 +bm_std::function_calls____Method::get_string 893 ns 893 ns 783150 + +bm_rtl::function_calls__Function::get_string 881 ns 881 ns 783511 +bm_rtl::method_calls______Method::get_string 892 ns 892 ns 785936 + +bm_rtl::function__ErasedReturnType::get_string 1126 ns 1125 ns 633797 +bm_rtl::method____ErasedReturnType::get_string 1137 ns 1137 ns 602780 +bm_rtl::method____ErasedTargetType::get_string 932 ns 931 ns 758769 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1108 ns 1108 ns 602980 +----------------------------------- +[2025-11-04 12:25:22] >>> Run 1: workload scale = 35 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 35 iterations +============================================= + +2025-11-04T12:25:22+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 2237.04 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.10, 1.18, 1.01 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 750 ns 750 ns 924083 + +bm_call::via_function_ptr__Function::set_string 757 ns 757 ns 920347 +bm_call::via_function_ptr____Method::set_string 771 ns 771 ns 912619 + +bm_std::function_calls__Function::set_string 780 ns 780 ns 883371 +bm_std::function_calls____Method::set_string 781 ns 780 ns 898678 + +bm_rtl::function_calls__Function::set_string 787 ns 787 ns 862899 +bm_rtl::method_calls______Method::set_string 796 ns 796 ns 914393 + +bm_rtl::function__ErasedReturnType::set_string 775 ns 775 ns 874764 +bm_rtl::method____ErasedReturnType::set_string 776 ns 776 ns 907678 +bm_rtl::method____ErasedTargetType::set_string 790 ns 789 ns 866660 +bm_rtl::method____ErasedTargetAndReturnType::set_string 805 ns 805 ns 869127 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1383 ns 1383 ns 499739 + +bm_call::via_function_ptr__Function::get_string 1315 ns 1315 ns 524654 +bm_call::via_function_ptr____Method::get_string 1326 ns 1326 ns 513208 + +bm_std::function_calls__Function::get_string 1309 ns 1309 ns 531060 +bm_std::function_calls____Method::get_string 1331 ns 1331 ns 534228 + +bm_rtl::function_calls__Function::get_string 1326 ns 1326 ns 514575 +bm_rtl::method_calls______Method::get_string 1326 ns 1326 ns 525314 + +bm_rtl::function__ErasedReturnType::get_string 1549 ns 1549 ns 447415 +bm_rtl::method____ErasedReturnType::get_string 1543 ns 1543 ns 452767 +bm_rtl::method____ErasedTargetType::get_string 1352 ns 1351 ns 524647 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1562 ns 1562 ns 434293 +----------------------------------- +[2025-11-04 12:25:40] >>> Run 2: workload scale = 35 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 35 iterations +============================================= + +2025-11-04T12:25:40+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 3670.17 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.22, 1.21, 1.02 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 743 ns 743 ns 909759 + +bm_call::via_function_ptr__Function::set_string 740 ns 740 ns 930090 +bm_call::via_function_ptr____Method::set_string 744 ns 744 ns 933324 + +bm_std::function_calls__Function::set_string 743 ns 743 ns 913502 +bm_std::function_calls____Method::set_string 758 ns 758 ns 931457 + +bm_rtl::function_calls__Function::set_string 767 ns 767 ns 910065 +bm_rtl::method_calls______Method::set_string 743 ns 743 ns 931388 + +bm_rtl::function__ErasedReturnType::set_string 775 ns 775 ns 921081 +bm_rtl::method____ErasedReturnType::set_string 761 ns 761 ns 915625 +bm_rtl::method____ErasedTargetType::set_string 756 ns 756 ns 913038 +bm_rtl::method____ErasedTargetAndReturnType::set_string 771 ns 771 ns 901263 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1357 ns 1357 ns 502661 + +bm_call::via_function_ptr__Function::get_string 1408 ns 1408 ns 503040 +bm_call::via_function_ptr____Method::get_string 1446 ns 1446 ns 478290 + +bm_std::function_calls__Function::get_string 1373 ns 1373 ns 498957 +bm_std::function_calls____Method::get_string 1398 ns 1398 ns 502891 + +bm_rtl::function_calls__Function::get_string 1395 ns 1395 ns 488686 +bm_rtl::method_calls______Method::get_string 1382 ns 1382 ns 497336 + +bm_rtl::function__ErasedReturnType::get_string 1560 ns 1560 ns 425909 +bm_rtl::method____ErasedReturnType::get_string 1542 ns 1542 ns 450811 +bm_rtl::method____ErasedTargetType::get_string 1337 ns 1337 ns 521375 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1552 ns 1552 ns 447731 +----------------------------------- +[2025-11-04 12:25:58] >>> Run 3: workload scale = 35 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 35 iterations +============================================= + +2025-11-04T12:25:58+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 4129.78 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.23, 1.21, 1.02 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 699 ns 699 ns 970616 + +bm_call::via_function_ptr__Function::set_string 733 ns 732 ns 992416 +bm_call::via_function_ptr____Method::set_string 743 ns 743 ns 951176 + +bm_std::function_calls__Function::set_string 719 ns 718 ns 953330 +bm_std::function_calls____Method::set_string 722 ns 722 ns 981699 + +bm_rtl::function_calls__Function::set_string 716 ns 716 ns 988945 +bm_rtl::method_calls______Method::set_string 711 ns 711 ns 992867 + +bm_rtl::function__ErasedReturnType::set_string 729 ns 728 ns 961326 +bm_rtl::method____ErasedReturnType::set_string 762 ns 762 ns 954194 +bm_rtl::method____ErasedTargetType::set_string 768 ns 768 ns 893804 +bm_rtl::method____ErasedTargetAndReturnType::set_string 737 ns 736 ns 929658 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1318 ns 1317 ns 529166 + +bm_call::via_function_ptr__Function::get_string 1321 ns 1321 ns 530054 +bm_call::via_function_ptr____Method::get_string 1316 ns 1316 ns 531188 + +bm_std::function_calls__Function::get_string 1319 ns 1319 ns 531843 +bm_std::function_calls____Method::get_string 1321 ns 1321 ns 532253 + +bm_rtl::function_calls__Function::get_string 1319 ns 1319 ns 531646 +bm_rtl::method_calls______Method::get_string 1319 ns 1319 ns 528183 + +bm_rtl::function__ErasedReturnType::get_string 1615 ns 1614 ns 444285 +bm_rtl::method____ErasedReturnType::get_string 1592 ns 1592 ns 436514 +bm_rtl::method____ErasedTargetType::get_string 1407 ns 1407 ns 496278 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1624 ns 1624 ns 430770 +----------------------------------- +[2025-11-04 12:26:16] >>> Run 1: workload scale = 40 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 40 iterations +============================================= + +2025-11-04T12:26:16+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 1742.32 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.30, 1.23, 1.03 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 786 ns 785 ns 874794 + +bm_call::via_function_ptr__Function::set_string 789 ns 789 ns 874362 +bm_call::via_function_ptr____Method::set_string 790 ns 790 ns 883497 + +bm_std::function_calls__Function::set_string 786 ns 786 ns 884943 +bm_std::function_calls____Method::set_string 790 ns 790 ns 870155 + +bm_rtl::function_calls__Function::set_string 790 ns 790 ns 878262 +bm_rtl::method_calls______Method::set_string 791 ns 791 ns 871008 + +bm_rtl::function__ErasedReturnType::set_string 793 ns 793 ns 881206 +bm_rtl::method____ErasedReturnType::set_string 794 ns 794 ns 876546 +bm_rtl::method____ErasedTargetType::set_string 792 ns 792 ns 872609 +bm_rtl::method____ErasedTargetAndReturnType::set_string 794 ns 794 ns 875157 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1478 ns 1478 ns 473478 + +bm_call::via_function_ptr__Function::get_string 1469 ns 1469 ns 473069 +bm_call::via_function_ptr____Method::get_string 1468 ns 1468 ns 473326 + +bm_std::function_calls__Function::get_string 1471 ns 1470 ns 473822 +bm_std::function_calls____Method::get_string 1473 ns 1473 ns 472376 + +bm_rtl::function_calls__Function::get_string 1473 ns 1473 ns 473798 +bm_rtl::method_calls______Method::get_string 1470 ns 1470 ns 476866 + +bm_rtl::function__ErasedReturnType::get_string 1821 ns 1821 ns 385183 +bm_rtl::method____ErasedReturnType::get_string 1816 ns 1816 ns 385499 +bm_rtl::method____ErasedTargetType::get_string 1489 ns 1489 ns 469694 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1821 ns 1821 ns 382024 +----------------------------------- +[2025-11-04 12:26:34] >>> Run 2: workload scale = 40 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 40 iterations +============================================= + +2025-11-04T12:26:34+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 1593.45 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.23, 1.22, 1.03 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 785 ns 785 ns 883374 + +bm_call::via_function_ptr__Function::set_string 796 ns 796 ns 886782 +bm_call::via_function_ptr____Method::set_string 794 ns 794 ns 877309 + +bm_std::function_calls__Function::set_string 794 ns 794 ns 873699 +bm_std::function_calls____Method::set_string 796 ns 796 ns 872066 + +bm_rtl::function_calls__Function::set_string 793 ns 793 ns 885099 +bm_rtl::method_calls______Method::set_string 816 ns 816 ns 841390 + +bm_rtl::function__ErasedReturnType::set_string 802 ns 802 ns 847247 +bm_rtl::method____ErasedReturnType::set_string 802 ns 802 ns 858644 +bm_rtl::method____ErasedTargetType::set_string 798 ns 797 ns 870491 +bm_rtl::method____ErasedTargetAndReturnType::set_string 797 ns 797 ns 870936 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1507 ns 1507 ns 461478 + +bm_call::via_function_ptr__Function::get_string 1507 ns 1507 ns 461730 +bm_call::via_function_ptr____Method::get_string 1507 ns 1507 ns 464680 + +bm_std::function_calls__Function::get_string 1507 ns 1507 ns 463574 +bm_std::function_calls____Method::get_string 1520 ns 1520 ns 464089 + +bm_rtl::function_calls__Function::get_string 1504 ns 1503 ns 458070 +bm_rtl::method_calls______Method::get_string 1517 ns 1517 ns 463656 + +bm_rtl::function__ErasedReturnType::get_string 1837 ns 1837 ns 382222 +bm_rtl::method____ErasedReturnType::get_string 1840 ns 1840 ns 381090 +bm_rtl::method____ErasedTargetType::get_string 1521 ns 1521 ns 454047 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1841 ns 1840 ns 381784 +----------------------------------- +[2025-11-04 12:26:52] >>> Run 3: workload scale = 40 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 40 iterations +============================================= + +2025-11-04T12:26:52+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.16, 1.20, 1.03 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 765 ns 765 ns 900609 + +bm_call::via_function_ptr__Function::set_string 773 ns 773 ns 902357 +bm_call::via_function_ptr____Method::set_string 775 ns 775 ns 895698 + +bm_std::function_calls__Function::set_string 769 ns 769 ns 884989 +bm_std::function_calls____Method::set_string 770 ns 770 ns 905215 + +bm_rtl::function_calls__Function::set_string 781 ns 781 ns 893172 +bm_rtl::method_calls______Method::set_string 785 ns 785 ns 871377 + +bm_rtl::function__ErasedReturnType::set_string 796 ns 796 ns 876191 +bm_rtl::method____ErasedReturnType::set_string 795 ns 795 ns 870611 +bm_rtl::method____ErasedTargetType::set_string 786 ns 786 ns 875116 +bm_rtl::method____ErasedTargetAndReturnType::set_string 793 ns 793 ns 853059 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1482 ns 1482 ns 471648 + +bm_call::via_function_ptr__Function::get_string 1478 ns 1477 ns 472419 +bm_call::via_function_ptr____Method::get_string 1487 ns 1487 ns 474564 + +bm_std::function_calls__Function::get_string 1479 ns 1479 ns 467774 +bm_std::function_calls____Method::get_string 1468 ns 1468 ns 475985 + +bm_rtl::function_calls__Function::get_string 1477 ns 1477 ns 471129 +bm_rtl::method_calls______Method::get_string 1484 ns 1483 ns 471432 + +bm_rtl::function__ErasedReturnType::get_string 1830 ns 1829 ns 379477 +bm_rtl::method____ErasedReturnType::get_string 1833 ns 1833 ns 381079 +bm_rtl::method____ErasedTargetType::get_string 1499 ns 1499 ns 460559 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1837 ns 1837 ns 375044 +----------------------------------- +[2025-11-04 12:27:10] >>> Run 1: workload scale = 45 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 45 iterations +============================================= + +2025-11-04T12:27:10+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 2727.08 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.12, 1.19, 1.03 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 859 ns 859 ns 811645 + +bm_call::via_function_ptr__Function::set_string 868 ns 868 ns 810851 +bm_call::via_function_ptr____Method::set_string 865 ns 865 ns 807435 + +bm_std::function_calls__Function::set_string 864 ns 863 ns 780880 +bm_std::function_calls____Method::set_string 872 ns 872 ns 806447 + +bm_rtl::function_calls__Function::set_string 866 ns 865 ns 809246 +bm_rtl::method_calls______Method::set_string 857 ns 857 ns 818472 + +bm_rtl::function__ErasedReturnType::set_string 880 ns 880 ns 787509 +bm_rtl::method____ErasedReturnType::set_string 876 ns 876 ns 795235 +bm_rtl::method____ErasedTargetType::set_string 866 ns 866 ns 790561 +bm_rtl::method____ErasedTargetAndReturnType::set_string 880 ns 880 ns 799653 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1656 ns 1656 ns 423691 + +bm_call::via_function_ptr__Function::get_string 1645 ns 1645 ns 412059 +bm_call::via_function_ptr____Method::get_string 1651 ns 1651 ns 421852 + +bm_std::function_calls__Function::get_string 1674 ns 1674 ns 417578 +bm_std::function_calls____Method::get_string 1656 ns 1656 ns 425072 + +bm_rtl::function_calls__Function::get_string 1631 ns 1631 ns 426111 +bm_rtl::method_calls______Method::get_string 1724 ns 1724 ns 420215 + +bm_rtl::function__ErasedReturnType::get_string 2239 ns 2239 ns 319096 +bm_rtl::method____ErasedReturnType::get_string 2118 ns 2117 ns 319400 +bm_rtl::method____ErasedTargetType::get_string 1635 ns 1634 ns 419574 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2082 ns 2081 ns 341195 +----------------------------------- +[2025-11-04 12:27:29] >>> Run 2: workload scale = 45 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 45 iterations +============================================= + +2025-11-04T12:27:29+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 4086.01 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.17, 1.19, 1.03 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 879 ns 879 ns 763667 + +bm_call::via_function_ptr__Function::set_string 899 ns 899 ns 800493 +bm_call::via_function_ptr____Method::set_string 874 ns 874 ns 784385 + +bm_std::function_calls__Function::set_string 917 ns 916 ns 791343 +bm_std::function_calls____Method::set_string 895 ns 894 ns 722973 + +bm_rtl::function_calls__Function::set_string 901 ns 901 ns 809623 +bm_rtl::method_calls______Method::set_string 886 ns 886 ns 772267 + +bm_rtl::function__ErasedReturnType::set_string 869 ns 869 ns 807341 +bm_rtl::method____ErasedReturnType::set_string 869 ns 869 ns 806497 +bm_rtl::method____ErasedTargetType::set_string 868 ns 868 ns 808556 +bm_rtl::method____ErasedTargetAndReturnType::set_string 869 ns 869 ns 807730 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1570 ns 1570 ns 445252 + +bm_call::via_function_ptr__Function::get_string 1566 ns 1566 ns 446490 +bm_call::via_function_ptr____Method::get_string 1564 ns 1564 ns 447557 + +bm_std::function_calls__Function::get_string 1565 ns 1565 ns 447484 +bm_std::function_calls____Method::get_string 1567 ns 1567 ns 447153 + +bm_rtl::function_calls__Function::get_string 1560 ns 1560 ns 449067 +bm_rtl::method_calls______Method::get_string 1558 ns 1558 ns 449923 + +bm_rtl::function__ErasedReturnType::get_string 2038 ns 2038 ns 342820 +bm_rtl::method____ErasedReturnType::get_string 2039 ns 2039 ns 343146 +bm_rtl::method____ErasedTargetType::get_string 1573 ns 1573 ns 445077 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2045 ns 2045 ns 342394 +----------------------------------- +[2025-11-04 12:27:48] >>> Run 3: workload scale = 45 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 45 iterations +============================================= + +2025-11-04T12:27:48+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.25, 1.21, 1.04 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 861 ns 861 ns 814704 + +bm_call::via_function_ptr__Function::set_string 857 ns 857 ns 817829 +bm_call::via_function_ptr____Method::set_string 858 ns 858 ns 813922 + +bm_std::function_calls__Function::set_string 863 ns 863 ns 813055 +bm_std::function_calls____Method::set_string 857 ns 857 ns 812189 + +bm_rtl::function_calls__Function::set_string 860 ns 860 ns 815403 +bm_rtl::method_calls______Method::set_string 855 ns 855 ns 817960 + +bm_rtl::function__ErasedReturnType::set_string 863 ns 863 ns 811827 +bm_rtl::method____ErasedReturnType::set_string 864 ns 864 ns 812329 +bm_rtl::method____ErasedTargetType::set_string 859 ns 859 ns 811367 +bm_rtl::method____ErasedTargetAndReturnType::set_string 872 ns 872 ns 806139 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1579 ns 1579 ns 443558 + +bm_call::via_function_ptr__Function::get_string 1567 ns 1566 ns 447638 +bm_call::via_function_ptr____Method::get_string 1561 ns 1561 ns 448644 + +bm_std::function_calls__Function::get_string 1578 ns 1578 ns 443746 +bm_std::function_calls____Method::get_string 1579 ns 1579 ns 442695 + +bm_rtl::function_calls__Function::get_string 1560 ns 1560 ns 448822 +bm_rtl::method_calls______Method::get_string 1567 ns 1567 ns 447470 + +bm_rtl::function__ErasedReturnType::get_string 2039 ns 2039 ns 343449 +bm_rtl::method____ErasedReturnType::get_string 2043 ns 2043 ns 343320 +bm_rtl::method____ErasedTargetType::get_string 1578 ns 1578 ns 443800 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2048 ns 2048 ns 342248 +----------------------------------- +[2025-11-04 12:28:06] >>> Run 1: workload scale = 50 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 50 iterations +============================================= + +2025-11-04T12:28:06+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.26, 1.21, 1.04 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 926 ns 926 ns 751413 + +bm_call::via_function_ptr__Function::set_string 915 ns 915 ns 767518 +bm_call::via_function_ptr____Method::set_string 919 ns 919 ns 763863 + +bm_std::function_calls__Function::set_string 937 ns 937 ns 751780 +bm_std::function_calls____Method::set_string 936 ns 936 ns 746176 + +bm_rtl::function_calls__Function::set_string 920 ns 920 ns 758837 +bm_rtl::method_calls______Method::set_string 917 ns 917 ns 767318 + +bm_rtl::function__ErasedReturnType::set_string 933 ns 933 ns 750999 +bm_rtl::method____ErasedReturnType::set_string 929 ns 929 ns 755410 +bm_rtl::method____ErasedTargetType::set_string 928 ns 928 ns 756971 +bm_rtl::method____ErasedTargetAndReturnType::set_string 936 ns 936 ns 747793 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1788 ns 1788 ns 391424 + +bm_call::via_function_ptr__Function::get_string 1786 ns 1786 ns 389634 +bm_call::via_function_ptr____Method::get_string 1783 ns 1782 ns 392565 + +bm_std::function_calls__Function::get_string 1790 ns 1790 ns 391537 +bm_std::function_calls____Method::get_string 1784 ns 1784 ns 392494 + +bm_rtl::function_calls__Function::get_string 1702 ns 1702 ns 412018 +bm_rtl::method_calls______Method::get_string 1698 ns 1698 ns 412199 + +bm_rtl::function__ErasedReturnType::get_string 2253 ns 2253 ns 311171 +bm_rtl::method____ErasedReturnType::get_string 2246 ns 2246 ns 311656 +bm_rtl::method____ErasedTargetType::get_string 1715 ns 1715 ns 408229 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2250 ns 2250 ns 310623 +----------------------------------- +[2025-11-04 12:28:25] >>> Run 2: workload scale = 50 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 50 iterations +============================================= + +2025-11-04T12:28:25+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.19, 1.20, 1.04 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 926 ns 926 ns 740549 + +bm_call::via_function_ptr__Function::set_string 916 ns 916 ns 770299 +bm_call::via_function_ptr____Method::set_string 916 ns 916 ns 762809 + +bm_std::function_calls__Function::set_string 938 ns 938 ns 745627 +bm_std::function_calls____Method::set_string 935 ns 935 ns 750822 + +bm_rtl::function_calls__Function::set_string 918 ns 918 ns 763866 +bm_rtl::method_calls______Method::set_string 917 ns 917 ns 765743 + +bm_rtl::function__ErasedReturnType::set_string 932 ns 932 ns 751226 +bm_rtl::method____ErasedReturnType::set_string 935 ns 935 ns 746666 +bm_rtl::method____ErasedTargetType::set_string 931 ns 931 ns 751925 +bm_rtl::method____ErasedTargetAndReturnType::set_string 943 ns 943 ns 743274 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1704 ns 1704 ns 411061 + +bm_call::via_function_ptr__Function::get_string 1701 ns 1701 ns 411864 +bm_call::via_function_ptr____Method::get_string 1696 ns 1696 ns 412619 + +bm_std::function_calls__Function::get_string 1699 ns 1699 ns 411971 +bm_std::function_calls____Method::get_string 1698 ns 1698 ns 412360 + +bm_rtl::function_calls__Function::get_string 1695 ns 1694 ns 413307 +bm_rtl::method_calls______Method::get_string 1694 ns 1694 ns 413337 + +bm_rtl::function__ErasedReturnType::get_string 2245 ns 2245 ns 311139 +bm_rtl::method____ErasedReturnType::get_string 2240 ns 2240 ns 312685 +bm_rtl::method____ErasedTargetType::get_string 1709 ns 1709 ns 409763 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2243 ns 2243 ns 311738 +----------------------------------- +[2025-11-04 12:28:44] >>> Run 3: workload scale = 50 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 50 iterations +============================================= + +2025-11-04T12:28:44+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.14, 1.19, 1.04 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 917 ns 917 ns 757756 + +bm_call::via_function_ptr__Function::set_string 906 ns 906 ns 777002 +bm_call::via_function_ptr____Method::set_string 908 ns 907 ns 772247 + +bm_std::function_calls__Function::set_string 931 ns 931 ns 745509 +bm_std::function_calls____Method::set_string 928 ns 928 ns 754015 + +bm_rtl::function_calls__Function::set_string 916 ns 916 ns 766789 +bm_rtl::method_calls______Method::set_string 909 ns 909 ns 770952 + +bm_rtl::function__ErasedReturnType::set_string 931 ns 931 ns 751400 +bm_rtl::method____ErasedReturnType::set_string 927 ns 927 ns 746782 +bm_rtl::method____ErasedTargetType::set_string 925 ns 925 ns 757055 +bm_rtl::method____ErasedTargetAndReturnType::set_string 930 ns 930 ns 753039 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1705 ns 1705 ns 410944 + +bm_call::via_function_ptr__Function::get_string 1705 ns 1705 ns 411331 +bm_call::via_function_ptr____Method::get_string 1699 ns 1698 ns 412291 + +bm_std::function_calls__Function::get_string 1701 ns 1701 ns 411580 +bm_std::function_calls____Method::get_string 1695 ns 1694 ns 410757 + +bm_rtl::function_calls__Function::get_string 1697 ns 1697 ns 412312 +bm_rtl::method_calls______Method::get_string 1699 ns 1699 ns 412540 + +bm_rtl::function__ErasedReturnType::get_string 2241 ns 2241 ns 312288 +bm_rtl::method____ErasedReturnType::get_string 2246 ns 2246 ns 312211 +bm_rtl::method____ErasedTargetType::get_string 1710 ns 1709 ns 409508 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2248 ns 2248 ns 311951 +----------------------------------- +[2025-11-04 12:29:03] >>> Run 1: workload scale = 58 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 58 iterations +============================================= + +2025-11-04T12:29:03+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.10, 1.18, 1.04 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1031 ns 1031 ns 675248 + +bm_call::via_function_ptr__Function::set_string 1026 ns 1026 ns 682545 +bm_call::via_function_ptr____Method::set_string 1027 ns 1027 ns 684770 + +bm_std::function_calls__Function::set_string 1034 ns 1034 ns 676829 +bm_std::function_calls____Method::set_string 1035 ns 1035 ns 675698 + +bm_rtl::function_calls__Function::set_string 1027 ns 1027 ns 682713 +bm_rtl::method_calls______Method::set_string 1043 ns 1043 ns 670770 + +bm_rtl::function__ErasedReturnType::set_string 1033 ns 1033 ns 678708 +bm_rtl::method____ErasedReturnType::set_string 1030 ns 1030 ns 679008 +bm_rtl::method____ErasedTargetType::set_string 1030 ns 1030 ns 681699 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1032 ns 1031 ns 680008 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2019 ns 2019 ns 347188 + +bm_call::via_function_ptr__Function::get_string 2013 ns 2013 ns 347842 +bm_call::via_function_ptr____Method::get_string 2010 ns 2010 ns 348147 + +bm_std::function_calls__Function::get_string 2017 ns 2017 ns 345495 +bm_std::function_calls____Method::get_string 2013 ns 2013 ns 347790 + +bm_rtl::function_calls__Function::get_string 2012 ns 2012 ns 348405 +bm_rtl::method_calls______Method::get_string 2004 ns 2004 ns 349276 + +bm_rtl::function__ErasedReturnType::get_string 2618 ns 2618 ns 267985 +bm_rtl::method____ErasedReturnType::get_string 2615 ns 2615 ns 267741 +bm_rtl::method____ErasedTargetType::get_string 2027 ns 2027 ns 345609 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2617 ns 2617 ns 266663 +----------------------------------- +[2025-11-04 12:29:22] >>> Run 2: workload scale = 58 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 58 iterations +============================================= + +2025-11-04T12:29:22+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 973.131 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.07, 1.16, 1.04 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1028 ns 1028 ns 677855 + +bm_call::via_function_ptr__Function::set_string 1030 ns 1030 ns 679335 +bm_call::via_function_ptr____Method::set_string 1030 ns 1030 ns 680947 + +bm_std::function_calls__Function::set_string 1027 ns 1027 ns 684721 +bm_std::function_calls____Method::set_string 1026 ns 1026 ns 681824 + +bm_rtl::function_calls__Function::set_string 1029 ns 1029 ns 678759 +bm_rtl::method_calls______Method::set_string 1029 ns 1029 ns 681165 + +bm_rtl::function__ErasedReturnType::set_string 1034 ns 1034 ns 677875 +bm_rtl::method____ErasedReturnType::set_string 1035 ns 1035 ns 676821 +bm_rtl::method____ErasedTargetType::set_string 1030 ns 1030 ns 680401 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1033 ns 1033 ns 678651 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2008 ns 2007 ns 348680 + +bm_call::via_function_ptr__Function::get_string 2012 ns 2012 ns 348322 +bm_call::via_function_ptr____Method::get_string 2007 ns 2007 ns 348814 + +bm_std::function_calls__Function::get_string 2004 ns 2004 ns 349186 +bm_std::function_calls____Method::get_string 2002 ns 2002 ns 348243 + +bm_rtl::function_calls__Function::get_string 2007 ns 2007 ns 348882 +bm_rtl::method_calls______Method::get_string 2004 ns 2004 ns 349758 + +bm_rtl::function__ErasedReturnType::get_string 2604 ns 2604 ns 268928 +bm_rtl::method____ErasedReturnType::get_string 2612 ns 2612 ns 268364 +bm_rtl::method____ErasedTargetType::get_string 2016 ns 2016 ns 347257 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2614 ns 2614 ns 268179 +----------------------------------- +[2025-11-04 12:29:41] >>> Run 3: workload scale = 58 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 58 iterations +============================================= + +2025-11-04T12:29:41+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 2968.51 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.05, 1.15, 1.04 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1040 ns 1040 ns 671097 + +bm_call::via_function_ptr__Function::set_string 1033 ns 1033 ns 676942 +bm_call::via_function_ptr____Method::set_string 1030 ns 1030 ns 678677 + +bm_std::function_calls__Function::set_string 1038 ns 1038 ns 674691 +bm_std::function_calls____Method::set_string 1037 ns 1037 ns 675090 + +bm_rtl::function_calls__Function::set_string 1026 ns 1026 ns 678381 +bm_rtl::method_calls______Method::set_string 1032 ns 1032 ns 679923 + +bm_rtl::function__ErasedReturnType::set_string 1033 ns 1033 ns 675492 +bm_rtl::method____ErasedReturnType::set_string 1037 ns 1037 ns 674332 +bm_rtl::method____ErasedTargetType::set_string 1033 ns 1033 ns 680263 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1035 ns 1035 ns 675409 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2011 ns 2011 ns 348434 + +bm_call::via_function_ptr__Function::get_string 2005 ns 2005 ns 349051 +bm_call::via_function_ptr____Method::get_string 2007 ns 2006 ns 349321 + +bm_std::function_calls__Function::get_string 2007 ns 2007 ns 348916 +bm_std::function_calls____Method::get_string 2012 ns 2012 ns 348275 + +bm_rtl::function_calls__Function::get_string 2002 ns 2002 ns 349353 +bm_rtl::method_calls______Method::get_string 1998 ns 1998 ns 350484 + +bm_rtl::function__ErasedReturnType::get_string 2604 ns 2604 ns 267612 +bm_rtl::method____ErasedReturnType::get_string 2604 ns 2604 ns 268910 +bm_rtl::method____ErasedTargetType::get_string 2018 ns 2018 ns 345292 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2607 ns 2607 ns 268415 +----------------------------------- +[2025-11-04 12:30:00] >>> Run 1: workload scale = 66 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 66 iterations +============================================= + +2025-11-04T12:30:00+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 2220.56 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.04, 1.14, 1.03 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1634 ns 1633 ns 428902 + +bm_call::via_function_ptr__Function::set_string 1630 ns 1629 ns 429772 +bm_call::via_function_ptr____Method::set_string 1631 ns 1631 ns 430681 + +bm_std::function_calls__Function::set_string 1631 ns 1631 ns 428808 +bm_std::function_calls____Method::set_string 1635 ns 1635 ns 428582 + +bm_rtl::function_calls__Function::set_string 1630 ns 1630 ns 429178 +bm_rtl::method_calls______Method::set_string 1633 ns 1632 ns 428391 + +bm_rtl::function__ErasedReturnType::set_string 1636 ns 1636 ns 424931 +bm_rtl::method____ErasedReturnType::set_string 1639 ns 1639 ns 426912 +bm_rtl::method____ErasedTargetType::set_string 1637 ns 1637 ns 427969 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1637 ns 1637 ns 427833 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2782 ns 2782 ns 251867 + +bm_call::via_function_ptr__Function::get_string 2777 ns 2777 ns 252122 +bm_call::via_function_ptr____Method::get_string 2783 ns 2783 ns 251687 + +bm_std::function_calls__Function::get_string 2790 ns 2790 ns 250927 +bm_std::function_calls____Method::get_string 2781 ns 2781 ns 252071 + +bm_rtl::function_calls__Function::get_string 2783 ns 2782 ns 251500 +bm_rtl::method_calls______Method::get_string 2781 ns 2781 ns 252113 + +bm_rtl::function__ErasedReturnType::get_string 3385 ns 3384 ns 206887 +bm_rtl::method____ErasedReturnType::get_string 3389 ns 3389 ns 206881 +bm_rtl::method____ErasedTargetType::get_string 2796 ns 2796 ns 250294 +bm_rtl::method____ErasedTargetAndReturnType::get_string 3391 ns 3391 ns 206588 +----------------------------------- +[2025-11-04 12:30:22] >>> Run 2: workload scale = 66 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 66 iterations +============================================= + +2025-11-04T12:30:22+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 3530.37 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.02, 1.13, 1.03 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1622 ns 1622 ns 430852 + +bm_call::via_function_ptr__Function::set_string 1623 ns 1623 ns 431449 +bm_call::via_function_ptr____Method::set_string 1621 ns 1621 ns 431436 + +bm_std::function_calls__Function::set_string 1625 ns 1625 ns 430362 +bm_std::function_calls____Method::set_string 1625 ns 1625 ns 431010 + +bm_rtl::function_calls__Function::set_string 1624 ns 1624 ns 430846 +bm_rtl::method_calls______Method::set_string 1624 ns 1624 ns 431257 + +bm_rtl::function__ErasedReturnType::set_string 1630 ns 1630 ns 428687 +bm_rtl::method____ErasedReturnType::set_string 1629 ns 1629 ns 429973 +bm_rtl::method____ErasedTargetType::set_string 1626 ns 1625 ns 430676 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1629 ns 1629 ns 430277 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2765 ns 2765 ns 253039 + +bm_call::via_function_ptr__Function::get_string 2763 ns 2763 ns 253401 +bm_call::via_function_ptr____Method::get_string 2763 ns 2763 ns 253536 + +bm_std::function_calls__Function::get_string 2765 ns 2765 ns 253255 +bm_std::function_calls____Method::get_string 2761 ns 2761 ns 253706 + +bm_rtl::function_calls__Function::get_string 2763 ns 2763 ns 253459 +bm_rtl::method_calls______Method::get_string 2758 ns 2758 ns 253800 + +bm_rtl::function__ErasedReturnType::get_string 3375 ns 3375 ns 207380 +bm_rtl::method____ErasedReturnType::get_string 3368 ns 3368 ns 207775 +bm_rtl::method____ErasedTargetType::get_string 2782 ns 2782 ns 251728 +bm_rtl::method____ErasedTargetAndReturnType::get_string 3368 ns 3368 ns 207848 +----------------------------------- +[2025-11-04 12:30:42] >>> Run 3: workload scale = 66 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 66 iterations +============================================= + +2025-11-04T12:30:42+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 3341.01 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.02, 1.12, 1.03 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1625 ns 1625 ns 430251 + +bm_call::via_function_ptr__Function::set_string 1626 ns 1626 ns 431687 +bm_call::via_function_ptr____Method::set_string 1626 ns 1625 ns 430629 + +bm_std::function_calls__Function::set_string 1626 ns 1626 ns 430290 +bm_std::function_calls____Method::set_string 1629 ns 1629 ns 429636 + +bm_rtl::function_calls__Function::set_string 1626 ns 1626 ns 430275 +bm_rtl::method_calls______Method::set_string 1627 ns 1627 ns 429935 + +bm_rtl::function__ErasedReturnType::set_string 1640 ns 1640 ns 426127 +bm_rtl::method____ErasedReturnType::set_string 1643 ns 1643 ns 426224 +bm_rtl::method____ErasedTargetType::set_string 1640 ns 1640 ns 427764 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1643 ns 1643 ns 426215 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2773 ns 2773 ns 252463 + +bm_call::via_function_ptr__Function::get_string 2767 ns 2767 ns 252937 +bm_call::via_function_ptr____Method::get_string 2768 ns 2768 ns 252976 + +bm_std::function_calls__Function::get_string 2772 ns 2772 ns 252487 +bm_std::function_calls____Method::get_string 2770 ns 2770 ns 252793 + +bm_rtl::function_calls__Function::get_string 2767 ns 2767 ns 253164 +bm_rtl::method_calls______Method::get_string 2770 ns 2770 ns 252709 + +bm_rtl::function__ErasedReturnType::get_string 3376 ns 3375 ns 207460 +bm_rtl::method____ErasedReturnType::get_string 3382 ns 3382 ns 207067 +bm_rtl::method____ErasedTargetType::get_string 2803 ns 2802 ns 249785 +bm_rtl::method____ErasedTargetAndReturnType::get_string 3384 ns 3384 ns 207041 +----------------------------------- +[2025-11-04 12:31:03] >>> Run 1: workload scale = 74 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 74 iterations +============================================= + +2025-11-04T12:31:03+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 4041.98 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.01, 1.11, 1.03 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1716 ns 1715 ns 408274 + +bm_call::via_function_ptr__Function::set_string 1712 ns 1712 ns 409361 +bm_call::via_function_ptr____Method::set_string 1713 ns 1713 ns 405493 + +bm_std::function_calls__Function::set_string 1718 ns 1717 ns 407832 +bm_std::function_calls____Method::set_string 1715 ns 1715 ns 408119 + +bm_rtl::function_calls__Function::set_string 1713 ns 1713 ns 408560 +bm_rtl::method_calls______Method::set_string 1709 ns 1709 ns 409044 + +bm_rtl::function__ErasedReturnType::set_string 1711 ns 1710 ns 408836 +bm_rtl::method____ErasedReturnType::set_string 1713 ns 1713 ns 408499 +bm_rtl::method____ErasedTargetType::set_string 1707 ns 1707 ns 409755 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1708 ns 1708 ns 409164 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 3084 ns 3084 ns 226877 + +bm_call::via_function_ptr__Function::get_string 3082 ns 3082 ns 227143 +bm_call::via_function_ptr____Method::get_string 3083 ns 3083 ns 227251 + +bm_std::function_calls__Function::get_string 3085 ns 3085 ns 226897 +bm_std::function_calls____Method::get_string 3086 ns 3085 ns 226916 + +bm_rtl::function_calls__Function::get_string 3085 ns 3085 ns 226921 +bm_rtl::method_calls______Method::get_string 3073 ns 3073 ns 227717 + +bm_rtl::function__ErasedReturnType::get_string 3715 ns 3715 ns 188463 +bm_rtl::method____ErasedReturnType::get_string 3719 ns 3719 ns 188241 +bm_rtl::method____ErasedTargetType::get_string 3088 ns 3088 ns 226725 +bm_rtl::method____ErasedTargetAndReturnType::get_string 3718 ns 3718 ns 188254 +----------------------------------- +[2025-11-04 12:31:25] >>> Run 2: workload scale = 74 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 74 iterations +============================================= + +2025-11-04T12:31:25+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.01, 1.11, 1.03 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1704 ns 1704 ns 411933 + +bm_call::via_function_ptr__Function::set_string 1699 ns 1699 ns 412511 +bm_call::via_function_ptr____Method::set_string 1702 ns 1702 ns 411047 + +bm_std::function_calls__Function::set_string 1702 ns 1702 ns 411998 +bm_std::function_calls____Method::set_string 1702 ns 1702 ns 411072 + +bm_rtl::function_calls__Function::set_string 1698 ns 1698 ns 409485 +bm_rtl::method_calls______Method::set_string 1702 ns 1702 ns 411717 + +bm_rtl::function__ErasedReturnType::set_string 1705 ns 1705 ns 409692 +bm_rtl::method____ErasedReturnType::set_string 1708 ns 1708 ns 408834 +bm_rtl::method____ErasedTargetType::set_string 1709 ns 1709 ns 410268 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1708 ns 1708 ns 409422 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 3072 ns 3072 ns 228015 + +bm_call::via_function_ptr__Function::get_string 3069 ns 3068 ns 228059 +bm_call::via_function_ptr____Method::get_string 3074 ns 3074 ns 227965 + +bm_std::function_calls__Function::get_string 3066 ns 3066 ns 228246 +bm_std::function_calls____Method::get_string 3070 ns 3070 ns 228340 + +bm_rtl::function_calls__Function::get_string 3066 ns 3066 ns 228209 +bm_rtl::method_calls______Method::get_string 3073 ns 3073 ns 228131 + +bm_rtl::function__ErasedReturnType::get_string 3716 ns 3715 ns 188572 +bm_rtl::method____ErasedReturnType::get_string 3720 ns 3720 ns 188419 +bm_rtl::method____ErasedTargetType::get_string 3085 ns 3085 ns 226900 +bm_rtl::method____ErasedTargetAndReturnType::get_string 3717 ns 3717 ns 187844 +----------------------------------- +[2025-11-04 12:31:46] >>> Run 3: workload scale = 74 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 74 iterations +============================================= + +2025-11-04T12:31:46+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 1641.19 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 1.10, 1.02 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1708 ns 1708 ns 409543 + +bm_call::via_function_ptr__Function::set_string 1707 ns 1707 ns 411072 +bm_call::via_function_ptr____Method::set_string 1705 ns 1704 ns 409726 + +bm_std::function_calls__Function::set_string 1710 ns 1710 ns 409640 +bm_std::function_calls____Method::set_string 1706 ns 1706 ns 410029 + +bm_rtl::function_calls__Function::set_string 1707 ns 1707 ns 409382 +bm_rtl::method_calls______Method::set_string 1704 ns 1704 ns 410793 + +bm_rtl::function__ErasedReturnType::set_string 1712 ns 1712 ns 409380 +bm_rtl::method____ErasedReturnType::set_string 1714 ns 1714 ns 406447 +bm_rtl::method____ErasedTargetType::set_string 1706 ns 1706 ns 409968 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1712 ns 1712 ns 409490 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 3068 ns 3068 ns 228115 + +bm_call::via_function_ptr__Function::get_string 3075 ns 3075 ns 228097 +bm_call::via_function_ptr____Method::get_string 3071 ns 3071 ns 228102 + +bm_std::function_calls__Function::get_string 3073 ns 3072 ns 228116 +bm_std::function_calls____Method::get_string 3073 ns 3072 ns 227749 + +bm_rtl::function_calls__Function::get_string 3074 ns 3074 ns 227707 +bm_rtl::method_calls______Method::get_string 3071 ns 3071 ns 228043 + +bm_rtl::function__ErasedReturnType::get_string 3716 ns 3716 ns 187872 +bm_rtl::method____ErasedReturnType::get_string 3717 ns 3717 ns 188232 +bm_rtl::method____ErasedTargetType::get_string 3092 ns 3092 ns 225613 +bm_rtl::method____ErasedTargetAndReturnType::get_string 3722 ns 3722 ns 188133 +----------------------------------- +[2025-11-04 12:32:08] >>> Run 1: workload scale = 82 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 82 iterations +============================================= + +2025-11-04T12:32:08+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 3729.3 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 1.09, 1.02 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1767 ns 1766 ns 395242 + +bm_call::via_function_ptr__Function::set_string 1772 ns 1772 ns 394957 +bm_call::via_function_ptr____Method::set_string 1772 ns 1772 ns 394786 + +bm_std::function_calls__Function::set_string 1771 ns 1771 ns 395414 +bm_std::function_calls____Method::set_string 1776 ns 1776 ns 395160 + +bm_rtl::function_calls__Function::set_string 1774 ns 1774 ns 394773 +bm_rtl::method_calls______Method::set_string 1780 ns 1780 ns 393690 + +bm_rtl::function__ErasedReturnType::set_string 1778 ns 1778 ns 393159 +bm_rtl::method____ErasedReturnType::set_string 1782 ns 1782 ns 393163 +bm_rtl::method____ErasedTargetType::set_string 1781 ns 1781 ns 392715 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1782 ns 1782 ns 392482 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 3335 ns 3335 ns 209233 + +bm_call::via_function_ptr__Function::get_string 3338 ns 3338 ns 209626 +bm_call::via_function_ptr____Method::get_string 3337 ns 3337 ns 209562 + +bm_std::function_calls__Function::get_string 3333 ns 3333 ns 210286 +bm_std::function_calls____Method::get_string 3337 ns 3337 ns 209884 + +bm_rtl::function_calls__Function::get_string 3338 ns 3338 ns 209988 +bm_rtl::method_calls______Method::get_string 3336 ns 3336 ns 209984 + +bm_rtl::function__ErasedReturnType::get_string 4070 ns 4069 ns 172155 +bm_rtl::method____ErasedReturnType::get_string 4068 ns 4067 ns 172083 +bm_rtl::method____ErasedTargetType::get_string 3352 ns 3351 ns 209120 +bm_rtl::method____ErasedTargetAndReturnType::get_string 4069 ns 4068 ns 172041 +----------------------------------- +[2025-11-04 12:32:30] >>> Run 2: workload scale = 82 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 82 iterations +============================================= + +2025-11-04T12:32:30+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 3961.21 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.07, 1.10, 1.02 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1776 ns 1776 ns 393592 + +bm_call::via_function_ptr__Function::set_string 1777 ns 1777 ns 394043 +bm_call::via_function_ptr____Method::set_string 1779 ns 1779 ns 393918 + +bm_std::function_calls__Function::set_string 1773 ns 1773 ns 395185 +bm_std::function_calls____Method::set_string 1773 ns 1773 ns 394879 + +bm_rtl::function_calls__Function::set_string 1778 ns 1778 ns 393670 +bm_rtl::method_calls______Method::set_string 1778 ns 1778 ns 393972 + +bm_rtl::function__ErasedReturnType::set_string 1787 ns 1787 ns 391688 +bm_rtl::method____ErasedReturnType::set_string 1787 ns 1787 ns 391402 +bm_rtl::method____ErasedTargetType::set_string 1783 ns 1783 ns 391780 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1785 ns 1785 ns 391770 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 3332 ns 3332 ns 209745 + +bm_call::via_function_ptr__Function::get_string 3332 ns 3331 ns 210115 +bm_call::via_function_ptr____Method::get_string 3333 ns 3333 ns 209826 + +bm_std::function_calls__Function::get_string 3326 ns 3326 ns 210463 +bm_std::function_calls____Method::get_string 3327 ns 3327 ns 210290 + +bm_rtl::function_calls__Function::get_string 3326 ns 3325 ns 210512 +bm_rtl::method_calls______Method::get_string 3325 ns 3325 ns 210556 + +bm_rtl::function__ErasedReturnType::get_string 4044 ns 4044 ns 173233 +bm_rtl::method____ErasedReturnType::get_string 4042 ns 4042 ns 173222 +bm_rtl::method____ErasedTargetType::get_string 3339 ns 3339 ns 209665 +bm_rtl::method____ErasedTargetAndReturnType::get_string 4043 ns 4043 ns 173090 +----------------------------------- +[2025-11-04 12:32:52] >>> Run 3: workload scale = 82 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 82 iterations +============================================= + +2025-11-04T12:32:52+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.04, 1.09, 1.02 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1784 ns 1783 ns 392280 + +bm_call::via_function_ptr__Function::set_string 1786 ns 1786 ns 392452 +bm_call::via_function_ptr____Method::set_string 1789 ns 1789 ns 391699 + +bm_std::function_calls__Function::set_string 1794 ns 1794 ns 390359 +bm_std::function_calls____Method::set_string 1804 ns 1804 ns 388507 + +bm_rtl::function_calls__Function::set_string 1811 ns 1811 ns 387372 +bm_rtl::method_calls______Method::set_string 1808 ns 1808 ns 387531 + +bm_rtl::function__ErasedReturnType::set_string 1782 ns 1782 ns 392864 +bm_rtl::method____ErasedReturnType::set_string 1785 ns 1785 ns 392227 +bm_rtl::method____ErasedTargetType::set_string 1780 ns 1780 ns 393273 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1780 ns 1780 ns 393240 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 3362 ns 3362 ns 208152 + +bm_call::via_function_ptr__Function::get_string 3366 ns 3366 ns 207975 +bm_call::via_function_ptr____Method::get_string 3368 ns 3368 ns 207809 + +bm_std::function_calls__Function::get_string 3362 ns 3361 ns 208229 +bm_std::function_calls____Method::get_string 3347 ns 3347 ns 209205 + +bm_rtl::function_calls__Function::get_string 3361 ns 3361 ns 208356 +bm_rtl::method_calls______Method::get_string 3349 ns 3349 ns 208934 + +bm_rtl::function__ErasedReturnType::get_string 4051 ns 4051 ns 172849 +bm_rtl::method____ErasedReturnType::get_string 4051 ns 4051 ns 172829 +bm_rtl::method____ErasedTargetType::get_string 3368 ns 3367 ns 207905 +bm_rtl::method____ErasedTargetAndReturnType::get_string 4048 ns 4048 ns 172912 +----------------------------------- +[2025-11-04 12:33:14] >>> Run 1: workload scale = 90 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 90 iterations +============================================= + +2025-11-04T12:33:14+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.03, 1.08, 1.02 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1850 ns 1850 ns 379224 + +bm_call::via_function_ptr__Function::set_string 1850 ns 1850 ns 378200 +bm_call::via_function_ptr____Method::set_string 1852 ns 1852 ns 378223 + +bm_std::function_calls__Function::set_string 1853 ns 1853 ns 377629 +bm_std::function_calls____Method::set_string 1853 ns 1852 ns 377833 + +bm_rtl::function_calls__Function::set_string 1853 ns 1852 ns 378253 +bm_rtl::method_calls______Method::set_string 1855 ns 1855 ns 377285 + +bm_rtl::function__ErasedReturnType::set_string 1866 ns 1865 ns 375269 +bm_rtl::method____ErasedReturnType::set_string 1872 ns 1872 ns 374394 +bm_rtl::method____ErasedTargetType::set_string 1865 ns 1864 ns 375297 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1870 ns 1869 ns 375229 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 3621 ns 3621 ns 193229 + +bm_call::via_function_ptr__Function::get_string 3620 ns 3620 ns 193390 +bm_call::via_function_ptr____Method::get_string 3619 ns 3619 ns 193491 + +bm_std::function_calls__Function::get_string 3627 ns 3627 ns 193051 +bm_std::function_calls____Method::get_string 3629 ns 3629 ns 192921 + +bm_rtl::function_calls__Function::get_string 3626 ns 3626 ns 193080 +bm_rtl::method_calls______Method::get_string 3630 ns 3630 ns 192853 + +bm_rtl::function__ErasedReturnType::get_string 4345 ns 4345 ns 161148 +bm_rtl::method____ErasedReturnType::get_string 4348 ns 4348 ns 160982 +bm_rtl::method____ErasedTargetType::get_string 3658 ns 3658 ns 191325 +bm_rtl::method____ErasedTargetAndReturnType::get_string 4350 ns 4350 ns 160848 +----------------------------------- +[2025-11-04 12:33:36] >>> Run 2: workload scale = 90 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 90 iterations +============================================= + +2025-11-04T12:33:36+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.02, 1.07, 1.02 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1850 ns 1850 ns 378250 + +bm_call::via_function_ptr__Function::set_string 1851 ns 1851 ns 378198 +bm_call::via_function_ptr____Method::set_string 1853 ns 1852 ns 377792 + +bm_std::function_calls__Function::set_string 1862 ns 1862 ns 376203 +bm_std::function_calls____Method::set_string 1859 ns 1859 ns 376918 + +bm_rtl::function_calls__Function::set_string 1864 ns 1864 ns 375389 +bm_rtl::method_calls______Method::set_string 1864 ns 1864 ns 375592 + +bm_rtl::function__ErasedReturnType::set_string 1877 ns 1877 ns 373174 +bm_rtl::method____ErasedReturnType::set_string 1877 ns 1877 ns 373198 +bm_rtl::method____ErasedTargetType::set_string 1871 ns 1870 ns 374468 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1876 ns 1876 ns 373838 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 3626 ns 3625 ns 193072 + +bm_call::via_function_ptr__Function::get_string 3623 ns 3623 ns 193302 +bm_call::via_function_ptr____Method::get_string 3622 ns 3622 ns 193279 + +bm_std::function_calls__Function::get_string 3630 ns 3630 ns 192894 +bm_std::function_calls____Method::get_string 3637 ns 3637 ns 192511 + +bm_rtl::function_calls__Function::get_string 3632 ns 3632 ns 192793 +bm_rtl::method_calls______Method::get_string 3629 ns 3629 ns 192875 + +bm_rtl::function__ErasedReturnType::get_string 4396 ns 4395 ns 159101 +bm_rtl::method____ErasedReturnType::get_string 4380 ns 4380 ns 159765 +bm_rtl::method____ErasedTargetType::get_string 3663 ns 3663 ns 191171 +bm_rtl::method____ErasedTargetAndReturnType::get_string 4382 ns 4382 ns 159762 +----------------------------------- +[2025-11-04 12:33:58] >>> Run 3: workload scale = 90 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 90 iterations +============================================= + +2025-11-04T12:33:58+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.01, 1.07, 1.02 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1867 ns 1867 ns 374901 + +bm_call::via_function_ptr__Function::set_string 1869 ns 1869 ns 374808 +bm_call::via_function_ptr____Method::set_string 1868 ns 1868 ns 374856 + +bm_std::function_calls__Function::set_string 1871 ns 1871 ns 374208 +bm_std::function_calls____Method::set_string 1860 ns 1860 ns 375819 + +bm_rtl::function_calls__Function::set_string 1873 ns 1873 ns 374232 +bm_rtl::method_calls______Method::set_string 1866 ns 1866 ns 375267 + +bm_rtl::function__ErasedReturnType::set_string 1885 ns 1885 ns 371538 +bm_rtl::method____ErasedReturnType::set_string 1899 ns 1899 ns 368497 +bm_rtl::method____ErasedTargetType::set_string 1882 ns 1882 ns 372145 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1896 ns 1896 ns 369384 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 3811 ns 3811 ns 183639 + +bm_call::via_function_ptr__Function::get_string 3811 ns 3811 ns 183675 +bm_call::via_function_ptr____Method::get_string 3809 ns 3808 ns 183773 + +bm_std::function_calls__Function::get_string 3821 ns 3821 ns 183176 +bm_std::function_calls____Method::get_string 3822 ns 3821 ns 183277 + +bm_rtl::function_calls__Function::get_string 3817 ns 3816 ns 183495 +bm_rtl::method_calls______Method::get_string 3820 ns 3820 ns 183226 + +bm_rtl::function__ErasedReturnType::get_string 4565 ns 4565 ns 153385 +bm_rtl::method____ErasedReturnType::get_string 4539 ns 4539 ns 154235 +bm_rtl::method____ErasedTargetType::get_string 3844 ns 3843 ns 182098 +bm_rtl::method____ErasedTargetAndReturnType::get_string 4541 ns 4540 ns 154162 +----------------------------------- +[2025-11-04 12:34:21] >>> Run 1: workload scale = 100 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 100 iterations +============================================= + +2025-11-04T12:34:21+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 954.973 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.01, 1.06, 1.01 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1961 ns 1961 ns 357857 + +bm_call::via_function_ptr__Function::set_string 1962 ns 1962 ns 356890 +bm_call::via_function_ptr____Method::set_string 1964 ns 1964 ns 356347 + +bm_std::function_calls__Function::set_string 1981 ns 1980 ns 353093 +bm_std::function_calls____Method::set_string 1980 ns 1980 ns 353920 + +bm_rtl::function_calls__Function::set_string 1986 ns 1985 ns 352760 +bm_rtl::method_calls______Method::set_string 1960 ns 1960 ns 357367 + +bm_rtl::function__ErasedReturnType::set_string 1966 ns 1966 ns 355968 +bm_rtl::method____ErasedReturnType::set_string 1966 ns 1966 ns 356507 +bm_rtl::method____ErasedTargetType::set_string 1965 ns 1965 ns 356382 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1969 ns 1969 ns 355503 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 4122 ns 4122 ns 169805 + +bm_call::via_function_ptr__Function::get_string 4123 ns 4122 ns 169776 +bm_call::via_function_ptr____Method::get_string 3985 ns 3985 ns 171499 + +bm_std::function_calls__Function::get_string 3952 ns 3951 ns 176989 +bm_std::function_calls____Method::get_string 3953 ns 3952 ns 177118 + +bm_rtl::function_calls__Function::get_string 3957 ns 3957 ns 176932 +bm_rtl::method_calls______Method::get_string 3957 ns 3957 ns 176974 + +bm_rtl::function__ErasedReturnType::get_string 4745 ns 4744 ns 147638 +bm_rtl::method____ErasedReturnType::get_string 4746 ns 4746 ns 147454 +bm_rtl::method____ErasedTargetType::get_string 3978 ns 3978 ns 175930 +bm_rtl::method____ErasedTargetAndReturnType::get_string 4745 ns 4745 ns 147401 +----------------------------------- +[2025-11-04 12:34:44] >>> Run 2: workload scale = 100 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 100 iterations +============================================= + +2025-11-04T12:34:44+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 1.06, 1.01 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1934 ns 1934 ns 361337 + +bm_call::via_function_ptr__Function::set_string 1940 ns 1940 ns 360781 +bm_call::via_function_ptr____Method::set_string 1936 ns 1936 ns 361609 + +bm_std::function_calls__Function::set_string 1937 ns 1936 ns 360705 +bm_std::function_calls____Method::set_string 1942 ns 1942 ns 361593 + +bm_rtl::function_calls__Function::set_string 1944 ns 1944 ns 360392 +bm_rtl::method_calls______Method::set_string 1945 ns 1945 ns 359927 + +bm_rtl::function__ErasedReturnType::set_string 1952 ns 1952 ns 358537 +bm_rtl::method____ErasedReturnType::set_string 1958 ns 1958 ns 357397 +bm_rtl::method____ErasedTargetType::set_string 1963 ns 1963 ns 357730 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1972 ns 1972 ns 354598 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 4096 ns 4096 ns 170858 + +bm_call::via_function_ptr__Function::get_string 4094 ns 4093 ns 170965 +bm_call::via_function_ptr____Method::get_string 4092 ns 4092 ns 171123 + +bm_std::function_calls__Function::get_string 4098 ns 4098 ns 170793 +bm_std::function_calls____Method::get_string 4103 ns 4103 ns 170634 + +bm_rtl::function_calls__Function::get_string 4102 ns 4102 ns 170611 +bm_rtl::method_calls______Method::get_string 4102 ns 4102 ns 170566 + +bm_rtl::function__ErasedReturnType::get_string 4891 ns 4891 ns 143266 +bm_rtl::method____ErasedReturnType::get_string 4896 ns 4895 ns 142971 +bm_rtl::method____ErasedTargetType::get_string 4128 ns 4128 ns 169566 +bm_rtl::method____ErasedTargetAndReturnType::get_string 4896 ns 4896 ns 142983 +----------------------------------- +[2025-11-04 12:35:07] >>> Run 3: workload scale = 100 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 100 iterations +============================================= + +2025-11-04T12:35:07+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 1.05, 1.01 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1977 ns 1977 ns 353596 + +bm_call::via_function_ptr__Function::set_string 1985 ns 1984 ns 353779 +bm_call::via_function_ptr____Method::set_string 1989 ns 1989 ns 352715 + +bm_std::function_calls__Function::set_string 2003 ns 2003 ns 350400 +bm_std::function_calls____Method::set_string 2008 ns 2008 ns 349132 + +bm_rtl::function_calls__Function::set_string 2006 ns 2006 ns 349311 +bm_rtl::method_calls______Method::set_string 2011 ns 2011 ns 349247 + +bm_rtl::function__ErasedReturnType::set_string 2000 ns 1999 ns 350105 +bm_rtl::method____ErasedReturnType::set_string 2000 ns 2000 ns 350108 +bm_rtl::method____ErasedTargetType::set_string 2002 ns 2002 ns 349732 +bm_rtl::method____ErasedTargetAndReturnType::set_string 2002 ns 2002 ns 349713 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 3976 ns 3976 ns 175636 + +bm_call::via_function_ptr__Function::get_string 3977 ns 3977 ns 176258 +bm_call::via_function_ptr____Method::get_string 3969 ns 3968 ns 176389 + +bm_std::function_calls__Function::get_string 4001 ns 4001 ns 175249 +bm_std::function_calls____Method::get_string 3993 ns 3993 ns 175269 + +bm_rtl::function_calls__Function::get_string 4006 ns 4006 ns 174915 +bm_rtl::method_calls______Method::get_string 3975 ns 3975 ns 176077 + +bm_rtl::function__ErasedReturnType::get_string 4735 ns 4735 ns 147503 +bm_rtl::method____ErasedReturnType::get_string 4744 ns 4744 ns 147790 +bm_rtl::method____ErasedTargetType::get_string 3979 ns 3979 ns 175845 +bm_rtl::method____ErasedTargetAndReturnType::get_string 4745 ns 4745 ns 147593 +----------------------------------- +[2025-11-04 12:35:30] >>> Run 1: workload scale = 120 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 120 iterations +============================================= + +2025-11-04T12:35:30+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 1.05, 1.01 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 2145 ns 2145 ns 326478 + +bm_call::via_function_ptr__Function::set_string 2145 ns 2145 ns 326264 +bm_call::via_function_ptr____Method::set_string 2148 ns 2148 ns 325609 + +bm_std::function_calls__Function::set_string 2150 ns 2149 ns 325379 +bm_std::function_calls____Method::set_string 2146 ns 2146 ns 326018 + +bm_rtl::function_calls__Function::set_string 2151 ns 2151 ns 325875 +bm_rtl::method_calls______Method::set_string 2152 ns 2152 ns 325215 + +bm_rtl::function__ErasedReturnType::set_string 2161 ns 2161 ns 324202 +bm_rtl::method____ErasedReturnType::set_string 2162 ns 2162 ns 324182 +bm_rtl::method____ErasedTargetType::set_string 2157 ns 2157 ns 324788 +bm_rtl::method____ErasedTargetAndReturnType::set_string 2162 ns 2161 ns 324038 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 4617 ns 4617 ns 151631 + +bm_call::via_function_ptr__Function::get_string 4617 ns 4617 ns 151639 +bm_call::via_function_ptr____Method::get_string 4617 ns 4616 ns 151716 + +bm_std::function_calls__Function::get_string 4627 ns 4626 ns 151346 +bm_std::function_calls____Method::get_string 4619 ns 4619 ns 151470 + +bm_rtl::function_calls__Function::get_string 4620 ns 4620 ns 151567 +bm_rtl::method_calls______Method::get_string 4620 ns 4620 ns 151462 + +bm_rtl::function__ErasedReturnType::get_string 5616 ns 5616 ns 124617 +bm_rtl::method____ErasedReturnType::get_string 5608 ns 5608 ns 124657 +bm_rtl::method____ErasedTargetType::get_string 4645 ns 4644 ns 150774 +bm_rtl::method____ErasedTargetAndReturnType::get_string 5612 ns 5612 ns 124546 +----------------------------------- +[2025-11-04 12:35:52] >>> Run 2: workload scale = 120 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 120 iterations +============================================= + +2025-11-04T12:35:52+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.06, 1.06, 1.01 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 2145 ns 2145 ns 326686 + +bm_call::via_function_ptr__Function::set_string 2143 ns 2143 ns 327072 +bm_call::via_function_ptr____Method::set_string 2142 ns 2142 ns 326938 + +bm_std::function_calls__Function::set_string 2152 ns 2152 ns 325170 +bm_std::function_calls____Method::set_string 2149 ns 2149 ns 326018 + +bm_rtl::function_calls__Function::set_string 2153 ns 2153 ns 325215 +bm_rtl::method_calls______Method::set_string 2150 ns 2150 ns 325278 + +bm_rtl::function__ErasedReturnType::set_string 2165 ns 2164 ns 323427 +bm_rtl::method____ErasedReturnType::set_string 2189 ns 2189 ns 319619 +bm_rtl::method____ErasedTargetType::set_string 2171 ns 2170 ns 322824 +bm_rtl::method____ErasedTargetAndReturnType::set_string 2181 ns 2181 ns 320945 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 4793 ns 4792 ns 146051 + +bm_call::via_function_ptr__Function::get_string 4795 ns 4794 ns 146001 +bm_call::via_function_ptr____Method::get_string 4792 ns 4792 ns 146108 + +bm_std::function_calls__Function::get_string 4649 ns 4649 ns 145872 +bm_std::function_calls____Method::get_string 4627 ns 4627 ns 150967 + +bm_rtl::function_calls__Function::get_string 4631 ns 4631 ns 151175 +bm_rtl::method_calls______Method::get_string 4632 ns 4632 ns 151161 + +bm_rtl::function__ErasedReturnType::get_string 5685 ns 5684 ns 123111 +bm_rtl::method____ErasedReturnType::get_string 5630 ns 5629 ns 124248 +bm_rtl::method____ErasedTargetType::get_string 4674 ns 4674 ns 149772 +bm_rtl::method____ErasedTargetAndReturnType::get_string 5637 ns 5637 ns 124261 +----------------------------------- +[2025-11-04 12:36:15] >>> Run 3: workload scale = 120 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 120 iterations +============================================= + +2025-11-04T12:36:15+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.04, 1.05, 1.01 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 2157 ns 2157 ns 324031 + +bm_call::via_function_ptr__Function::set_string 2157 ns 2157 ns 323762 +bm_call::via_function_ptr____Method::set_string 2158 ns 2158 ns 324457 + +bm_std::function_calls__Function::set_string 2168 ns 2168 ns 323051 +bm_std::function_calls____Method::set_string 2169 ns 2169 ns 322789 + +bm_rtl::function_calls__Function::set_string 2164 ns 2164 ns 324068 +bm_rtl::method_calls______Method::set_string 2162 ns 2162 ns 323716 + +bm_rtl::function__ErasedReturnType::set_string 2178 ns 2177 ns 322027 +bm_rtl::method____ErasedReturnType::set_string 2179 ns 2179 ns 321347 +bm_rtl::method____ErasedTargetType::set_string 2180 ns 2180 ns 321745 +bm_rtl::method____ErasedTargetAndReturnType::set_string 2180 ns 2180 ns 321062 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 4636 ns 4636 ns 151263 + +bm_call::via_function_ptr__Function::get_string 4632 ns 4631 ns 151234 +bm_call::via_function_ptr____Method::get_string 4627 ns 4627 ns 150946 + +bm_std::function_calls__Function::get_string 4643 ns 4642 ns 151075 +bm_std::function_calls____Method::get_string 4633 ns 4633 ns 151103 + +bm_rtl::function_calls__Function::get_string 4647 ns 4647 ns 150930 +bm_rtl::method_calls______Method::get_string 4634 ns 4634 ns 151052 + +bm_rtl::function__ErasedReturnType::get_string 5627 ns 5626 ns 124604 +bm_rtl::method____ErasedReturnType::get_string 5618 ns 5618 ns 124566 +bm_rtl::method____ErasedTargetType::get_string 4667 ns 4667 ns 150194 +bm_rtl::method____ErasedTargetAndReturnType::get_string 5622 ns 5622 ns 124669 +----------------------------------- +[2025-11-04 12:36:37] >>> Run 1: workload scale = 150 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 150 iterations +============================================= + +2025-11-04T12:36:37+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.08, 1.06, 1.01 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 3511 ns 3511 ns 199591 + +bm_call::via_function_ptr__Function::set_string 3504 ns 3504 ns 199578 +bm_call::via_function_ptr____Method::set_string 3513 ns 3512 ns 199781 + +bm_std::function_calls__Function::set_string 3518 ns 3518 ns 199107 +bm_std::function_calls____Method::set_string 3521 ns 3521 ns 199095 + +bm_rtl::function_calls__Function::set_string 3519 ns 3518 ns 199087 +bm_rtl::method_calls______Method::set_string 3525 ns 3525 ns 198202 + +bm_rtl::function__ErasedReturnType::set_string 3531 ns 3530 ns 198334 +bm_rtl::method____ErasedReturnType::set_string 3544 ns 3543 ns 197580 +bm_rtl::method____ErasedTargetType::set_string 3538 ns 3537 ns 198133 +bm_rtl::method____ErasedTargetAndReturnType::set_string 3545 ns 3544 ns 197480 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 6774 ns 6772 ns 103350 + +bm_call::via_function_ptr__Function::get_string 6773 ns 6772 ns 103343 +bm_call::via_function_ptr____Method::get_string 6772 ns 6772 ns 103373 + +bm_std::function_calls__Function::get_string 6784 ns 6783 ns 103220 +bm_std::function_calls____Method::get_string 6780 ns 6780 ns 103259 + +bm_rtl::function_calls__Function::get_string 6779 ns 6778 ns 103272 +bm_rtl::method_calls______Method::get_string 6782 ns 6781 ns 103246 + +bm_rtl::function__ErasedReturnType::get_string 7997 ns 7997 ns 87528 +bm_rtl::method____ErasedReturnType::get_string 7989 ns 7986 ns 87655 +bm_rtl::method____ErasedTargetType::get_string 6792 ns 6791 ns 103053 +bm_rtl::method____ErasedTargetAndReturnType::get_string 7992 ns 7989 ns 87557 +----------------------------------- +[2025-11-04 12:36:58] >>> Run 2: workload scale = 150 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 150 iterations +============================================= + +2025-11-04T12:36:58+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.06, 1.06, 1.01 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 3549 ns 3548 ns 197190 + +bm_call::via_function_ptr__Function::set_string 3550 ns 3550 ns 197298 +bm_call::via_function_ptr____Method::set_string 3545 ns 3545 ns 197213 + +bm_std::function_calls__Function::set_string 3557 ns 3556 ns 197059 +bm_std::function_calls____Method::set_string 3547 ns 3547 ns 197291 + +bm_rtl::function_calls__Function::set_string 3550 ns 3550 ns 197117 +bm_rtl::method_calls______Method::set_string 3555 ns 3554 ns 197038 + +bm_rtl::function__ErasedReturnType::set_string 3568 ns 3567 ns 196518 +bm_rtl::method____ErasedReturnType::set_string 3571 ns 3570 ns 195914 +bm_rtl::method____ErasedTargetType::set_string 3563 ns 3563 ns 196195 +bm_rtl::method____ErasedTargetAndReturnType::set_string 3567 ns 3566 ns 196254 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 6601 ns 6600 ns 106086 + +bm_call::via_function_ptr__Function::get_string 6598 ns 6597 ns 106016 +bm_call::via_function_ptr____Method::get_string 6598 ns 6597 ns 106208 + +bm_std::function_calls__Function::get_string 6607 ns 6606 ns 105997 +bm_std::function_calls____Method::get_string 6609 ns 6608 ns 105976 + +bm_rtl::function_calls__Function::get_string 6606 ns 6605 ns 105996 +bm_rtl::method_calls______Method::get_string 6601 ns 6600 ns 106125 + +bm_rtl::function__ErasedReturnType::get_string 7820 ns 7818 ns 89497 +bm_rtl::method____ErasedReturnType::get_string 7813 ns 7812 ns 89600 +bm_rtl::method____ErasedTargetType::get_string 6614 ns 6613 ns 105770 +bm_rtl::method____ErasedTargetAndReturnType::get_string 7815 ns 7814 ns 89559 +----------------------------------- +[2025-11-04 12:37:18] >>> Run 3: workload scale = 150 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 150 iterations +============================================= + +2025-11-04T12:37:18+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.04, 1.05, 1.01 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 3521 ns 3520 ns 198831 + +bm_call::via_function_ptr__Function::set_string 3519 ns 3519 ns 199065 +bm_call::via_function_ptr____Method::set_string 3520 ns 3519 ns 198988 + +bm_std::function_calls__Function::set_string 3529 ns 3528 ns 198384 +bm_std::function_calls____Method::set_string 3535 ns 3534 ns 198140 + +bm_rtl::function_calls__Function::set_string 3529 ns 3529 ns 198462 +bm_rtl::method_calls______Method::set_string 3528 ns 3528 ns 198319 + +bm_rtl::function__ErasedReturnType::set_string 3537 ns 3536 ns 197784 +bm_rtl::method____ErasedReturnType::set_string 3544 ns 3543 ns 197602 +bm_rtl::method____ErasedTargetType::set_string 3544 ns 3543 ns 197518 +bm_rtl::method____ErasedTargetAndReturnType::set_string 3547 ns 3546 ns 197510 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 6791 ns 6789 ns 103143 + +bm_call::via_function_ptr__Function::get_string 6789 ns 6788 ns 103109 +bm_call::via_function_ptr____Method::get_string 6789 ns 6787 ns 103031 + +bm_std::function_calls__Function::get_string 6785 ns 6783 ns 103175 +bm_std::function_calls____Method::get_string 6783 ns 6782 ns 103233 + +bm_rtl::function_calls__Function::get_string 6792 ns 6791 ns 103075 +bm_rtl::method_calls______Method::get_string 6796 ns 6795 ns 103017 + +bm_rtl::function__ErasedReturnType::get_string 7988 ns 7987 ns 87673 +bm_rtl::method____ErasedReturnType::get_string 7989 ns 7985 ns 87691 +bm_rtl::method____ErasedTargetType::get_string 6797 ns 6796 ns 103050 +bm_rtl::method____ErasedTargetAndReturnType::get_string 7990 ns 7988 ns 87626 +----------------------------------- +All benchmarks completed. diff --git a/text-benchmark-logs/benchmark_runs_string_view.log b/text-benchmark-logs/benchmark_runs_string_view.log new file mode 100644 index 00000000..0399b902 --- /dev/null +++ b/text-benchmark-logs/benchmark_runs_string_view.log @@ -0,0 +1,3167 @@ +Starting benchmark runs... +Binary: ./bin/RTLBenchmarkApp +Log: ./benchmark_runs.log +=================================== +[2025-11-04 11:28:24] >>> Run 1: workload scale = 0 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 0 iterations +============================================= + +2025-11-04T11:28:24+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 0.38, 0.13, 0.04 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 0.614 ns 0.614 ns 1000000000 + +bm_call::via_function_ptr__Function::set_string 1.02 ns 1.02 ns 683678776 +bm_call::via_function_ptr____Method::set_string 1.23 ns 1.23 ns 569885030 + +bm_std::function_calls__Function::set_string 1.23 ns 1.23 ns 562884499 +bm_std::function_calls____Method::set_string 1.64 ns 1.64 ns 426729520 + +bm_rtl::function_calls__Function::set_string 1.02 ns 1.02 ns 683865607 +bm_rtl::method_calls______Method::set_string 1.62 ns 1.62 ns 430515116 + +bm_rtl::function__ErasedReturnType::set_string 3.04 ns 3.04 ns 230360121 +bm_rtl::method____ErasedReturnType::set_string 4.04 ns 4.04 ns 172858129 +bm_rtl::method____ErasedTargetType::set_string 4.26 ns 4.26 ns 166388092 +bm_rtl::method____ErasedTargetAndReturnType::set_string 4.74 ns 4.74 ns 149410247 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1.48 ns 1.48 ns 466378476 + +bm_call::via_function_ptr__Function::get_string 2.58 ns 2.58 ns 270570089 +bm_call::via_function_ptr____Method::get_string 2.59 ns 2.59 ns 269322401 + +bm_std::function_calls__Function::get_string 2.76 ns 2.76 ns 251347073 +bm_std::function_calls____Method::get_string 3.27 ns 3.27 ns 217804162 + +bm_rtl::function_calls__Function::get_string 2.58 ns 2.58 ns 270312043 +bm_rtl::method_calls______Method::get_string 2.98 ns 2.98 ns 230536281 + +bm_rtl::function__ErasedReturnType::get_string 15.1 ns 15.1 ns 45710706 +bm_rtl::method____ErasedReturnType::get_string 15.8 ns 15.8 ns 44050977 +bm_rtl::method____ErasedTargetType::get_string 5.97 ns 5.97 ns 117370904 +bm_rtl::method____ErasedTargetAndReturnType::get_string 17.3 ns 17.3 ns 43244655 +----------------------------------- +[2025-11-04 11:28:44] >>> Run 2: workload scale = 0 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 0 iterations +============================================= + +2025-11-04T11:28:44+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 4611.4 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 0.78, 0.24, 0.08 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 0.634 ns 0.634 ns 1000000000 + +bm_call::via_function_ptr__Function::set_string 1.08 ns 1.08 ns 654860358 +bm_call::via_function_ptr____Method::set_string 1.30 ns 1.30 ns 525150563 + +bm_std::function_calls__Function::set_string 1.28 ns 1.28 ns 542946738 +bm_std::function_calls____Method::set_string 1.65 ns 1.65 ns 415930435 + +bm_rtl::function_calls__Function::set_string 1.07 ns 1.07 ns 676793908 +bm_rtl::method_calls______Method::set_string 1.68 ns 1.68 ns 408934924 + +bm_rtl::function__ErasedReturnType::set_string 3.20 ns 3.20 ns 229478489 +bm_rtl::method____ErasedReturnType::set_string 4.05 ns 4.05 ns 170238631 +bm_rtl::method____ErasedTargetType::set_string 4.22 ns 4.22 ns 164288125 +bm_rtl::method____ErasedTargetAndReturnType::set_string 4.68 ns 4.68 ns 150597958 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1.43 ns 1.43 ns 474635786 + +bm_call::via_function_ptr__Function::get_string 2.49 ns 2.49 ns 282523832 +bm_call::via_function_ptr____Method::get_string 2.48 ns 2.48 ns 283788061 + +bm_std::function_calls__Function::get_string 2.69 ns 2.69 ns 256523801 +bm_std::function_calls____Method::get_string 3.11 ns 3.11 ns 225496053 + +bm_rtl::function_calls__Function::get_string 2.56 ns 2.56 ns 271049574 +bm_rtl::method_calls______Method::get_string 2.95 ns 2.95 ns 242354631 + +bm_rtl::function__ErasedReturnType::get_string 15.5 ns 15.5 ns 45846828 +bm_rtl::method____ErasedReturnType::get_string 15.7 ns 15.7 ns 44262788 +bm_rtl::method____ErasedTargetType::get_string 5.89 ns 5.89 ns 117265605 +bm_rtl::method____ErasedTargetAndReturnType::get_string 16.3 ns 16.3 ns 42284738 +----------------------------------- +[2025-11-04 11:29:05] >>> Run 3: workload scale = 0 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 0 iterations +============================================= + +2025-11-04T11:29:05+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.13, 0.35, 0.12 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 0.543 ns 0.543 ns 1000000000 + +bm_call::via_function_ptr__Function::set_string 1.03 ns 1.03 ns 683567202 +bm_call::via_function_ptr____Method::set_string 1.23 ns 1.23 ns 569508463 + +bm_std::function_calls__Function::set_string 1.23 ns 1.23 ns 570111428 +bm_std::function_calls____Method::set_string 1.64 ns 1.64 ns 427615238 + +bm_rtl::function_calls__Function::set_string 1.02 ns 1.02 ns 684124829 +bm_rtl::method_calls______Method::set_string 1.62 ns 1.62 ns 476008120 + +bm_rtl::function__ErasedReturnType::set_string 3.02 ns 3.02 ns 230302984 +bm_rtl::method____ErasedReturnType::set_string 4.02 ns 4.02 ns 172265220 +bm_rtl::method____ErasedTargetType::set_string 4.26 ns 4.26 ns 164395945 +bm_rtl::method____ErasedTargetAndReturnType::set_string 4.67 ns 4.67 ns 151752309 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1.41 ns 1.41 ns 495458672 + +bm_call::via_function_ptr__Function::get_string 2.46 ns 2.46 ns 284981627 +bm_call::via_function_ptr____Method::get_string 2.49 ns 2.49 ns 280143091 + +bm_std::function_calls__Function::get_string 2.66 ns 2.66 ns 263196386 +bm_std::function_calls____Method::get_string 3.11 ns 3.10 ns 227498153 + +bm_rtl::function_calls__Function::get_string 2.46 ns 2.46 ns 284559260 +bm_rtl::method_calls______Method::get_string 2.87 ns 2.87 ns 244503914 + +bm_rtl::function__ErasedReturnType::get_string 14.7 ns 14.7 ns 48203413 +bm_rtl::method____ErasedReturnType::get_string 15.2 ns 15.2 ns 45954622 +bm_rtl::method____ErasedTargetType::get_string 5.81 ns 5.81 ns 120895674 +bm_rtl::method____ErasedTargetAndReturnType::get_string 16.4 ns 16.4 ns 42589796 +----------------------------------- +[2025-11-04 11:29:25] >>> Run 4: workload scale = 0 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 0 iterations +============================================= + +2025-11-04T11:29:25+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 4142.36 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.09, 0.39, 0.14 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 0.619 ns 0.620 ns 1000000000 + +bm_call::via_function_ptr__Function::set_string 1.02 ns 1.02 ns 683826531 +bm_call::via_function_ptr____Method::set_string 1.23 ns 1.23 ns 569466070 + +bm_std::function_calls__Function::set_string 1.23 ns 1.23 ns 563230061 +bm_std::function_calls____Method::set_string 1.64 ns 1.64 ns 427349799 + +bm_rtl::function_calls__Function::set_string 1.02 ns 1.03 ns 684106315 +bm_rtl::method_calls______Method::set_string 1.50 ns 1.50 ns 485473792 + +bm_rtl::function__ErasedReturnType::set_string 3.04 ns 3.04 ns 231054109 +bm_rtl::method____ErasedReturnType::set_string 4.01 ns 4.01 ns 177095634 +bm_rtl::method____ErasedTargetType::set_string 4.15 ns 4.15 ns 168485741 +bm_rtl::method____ErasedTargetAndReturnType::set_string 4.58 ns 4.58 ns 149929544 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1.42 ns 1.42 ns 495133376 + +bm_call::via_function_ptr__Function::get_string 2.45 ns 2.46 ns 285005788 +bm_call::via_function_ptr____Method::get_string 2.48 ns 2.48 ns 284236287 + +bm_std::function_calls__Function::get_string 2.66 ns 2.66 ns 263017751 +bm_std::function_calls____Method::get_string 3.10 ns 3.10 ns 224825065 + +bm_rtl::function_calls__Function::get_string 2.46 ns 2.46 ns 284512552 +bm_rtl::method_calls______Method::get_string 2.86 ns 2.86 ns 243917692 + +bm_rtl::function__ErasedReturnType::get_string 14.7 ns 14.7 ns 47450172 +bm_rtl::method____ErasedReturnType::get_string 15.2 ns 15.2 ns 46035495 +bm_rtl::method____ErasedTargetType::get_string 5.86 ns 5.86 ns 121152258 +bm_rtl::method____ErasedTargetAndReturnType::get_string 16.3 ns 16.3 ns 41584993 +----------------------------------- +[2025-11-04 11:29:46] >>> Run 5: workload scale = 0 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 0 iterations +============================================= + +2025-11-04T11:29:46+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.06, 0.43, 0.16 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 0.540 ns 0.540 ns 1000000000 + +bm_call::via_function_ptr__Function::set_string 1.03 ns 1.03 ns 682847039 +bm_call::via_function_ptr____Method::set_string 1.23 ns 1.23 ns 568512058 + +bm_std::function_calls__Function::set_string 1.23 ns 1.23 ns 569587483 +bm_std::function_calls____Method::set_string 1.64 ns 1.64 ns 427385239 + +bm_rtl::function_calls__Function::set_string 1.02 ns 1.02 ns 683618197 +bm_rtl::method_calls______Method::set_string 1.63 ns 1.63 ns 428438447 + +bm_rtl::function__ErasedReturnType::set_string 3.03 ns 3.03 ns 230910273 +bm_rtl::method____ErasedReturnType::set_string 3.96 ns 3.96 ns 177102134 +bm_rtl::method____ErasedTargetType::set_string 4.21 ns 4.21 ns 166155415 +bm_rtl::method____ErasedTargetAndReturnType::set_string 4.63 ns 4.63 ns 151585002 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1.42 ns 1.42 ns 495417193 + +bm_call::via_function_ptr__Function::get_string 2.45 ns 2.46 ns 285068393 +bm_call::via_function_ptr____Method::get_string 2.48 ns 2.48 ns 283577125 + +bm_std::function_calls__Function::get_string 2.66 ns 2.66 ns 263081859 +bm_std::function_calls____Method::get_string 3.09 ns 3.09 ns 225912956 + +bm_rtl::function_calls__Function::get_string 2.46 ns 2.46 ns 285086595 +bm_rtl::method_calls______Method::get_string 2.88 ns 2.88 ns 242840494 + +bm_rtl::function__ErasedReturnType::get_string 14.9 ns 14.9 ns 46919301 +bm_rtl::method____ErasedReturnType::get_string 15.0 ns 15.0 ns 45689265 +bm_rtl::method____ErasedTargetType::get_string 5.87 ns 5.88 ns 119688015 +bm_rtl::method____ErasedTargetAndReturnType::get_string 16.3 ns 16.3 ns 43375628 +----------------------------------- +[2025-11-04 11:30:06] >>> Run 1: workload scale = 1 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 1 iterations +============================================= + +2025-11-04T11:30:06+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.04, 0.47, 0.18 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 14.5 ns 14.5 ns 48242791 + +bm_call::via_function_ptr__Function::set_string 14.6 ns 14.6 ns 47568680 +bm_call::via_function_ptr____Method::set_string 14.5 ns 14.5 ns 48746560 + +bm_std::function_calls__Function::set_string 14.4 ns 14.4 ns 48361996 +bm_std::function_calls____Method::set_string 14.7 ns 14.7 ns 47229848 + +bm_rtl::function_calls__Function::set_string 14.3 ns 14.3 ns 47864234 +bm_rtl::method_calls______Method::set_string 15.0 ns 15.0 ns 46668705 + +bm_rtl::function__ErasedReturnType::set_string 16.8 ns 16.8 ns 41584347 +bm_rtl::method____ErasedReturnType::set_string 17.0 ns 17.0 ns 41277560 +bm_rtl::method____ErasedTargetType::set_string 17.9 ns 17.9 ns 38831295 +bm_rtl::method____ErasedTargetAndReturnType::set_string 18.1 ns 18.1 ns 38521566 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 21.4 ns 21.4 ns 32748201 + +bm_call::via_function_ptr__Function::get_string 21.7 ns 21.7 ns 32229019 +bm_call::via_function_ptr____Method::get_string 21.8 ns 21.8 ns 32216795 + +bm_std::function_calls__Function::get_string 21.8 ns 21.8 ns 32016965 +bm_std::function_calls____Method::get_string 21.7 ns 21.7 ns 32038907 + +bm_rtl::function_calls__Function::get_string 21.7 ns 21.7 ns 32075981 +bm_rtl::method_calls______Method::get_string 21.8 ns 21.8 ns 32139933 + +bm_rtl::function__ErasedReturnType::get_string 34.3 ns 34.3 ns 20292635 +bm_rtl::method____ErasedReturnType::get_string 35.5 ns 35.5 ns 19832365 +bm_rtl::method____ErasedTargetType::get_string 24.2 ns 24.2 ns 29003990 +bm_rtl::method____ErasedTargetAndReturnType::get_string 35.8 ns 35.8 ns 19482072 +----------------------------------- +[2025-11-04 11:30:27] >>> Run 2: workload scale = 1 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 1 iterations +============================================= + +2025-11-04T11:30:27+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.03, 0.51, 0.20 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 14.5 ns 14.5 ns 48600272 + +bm_call::via_function_ptr__Function::set_string 14.4 ns 14.4 ns 47262841 +bm_call::via_function_ptr____Method::set_string 14.7 ns 14.7 ns 47560475 + +bm_std::function_calls__Function::set_string 14.7 ns 14.7 ns 46778629 +bm_std::function_calls____Method::set_string 15.0 ns 15.0 ns 46225572 + +bm_rtl::function_calls__Function::set_string 14.4 ns 14.4 ns 47934169 +bm_rtl::method_calls______Method::set_string 15.0 ns 15.0 ns 46326371 + +bm_rtl::function__ErasedReturnType::set_string 16.7 ns 16.7 ns 41965256 +bm_rtl::method____ErasedReturnType::set_string 17.2 ns 17.2 ns 41096893 +bm_rtl::method____ErasedTargetType::set_string 17.5 ns 17.5 ns 40225175 +bm_rtl::method____ErasedTargetAndReturnType::set_string 18.1 ns 18.1 ns 38566575 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 21.1 ns 21.2 ns 32955668 + +bm_call::via_function_ptr__Function::get_string 21.2 ns 21.2 ns 33076981 +bm_call::via_function_ptr____Method::get_string 21.4 ns 21.4 ns 32585058 + +bm_std::function_calls__Function::get_string 21.3 ns 21.3 ns 32772706 +bm_std::function_calls____Method::get_string 22.2 ns 22.2 ns 31420316 + +bm_rtl::function_calls__Function::get_string 21.2 ns 21.2 ns 33089599 +bm_rtl::method_calls______Method::get_string 21.6 ns 21.6 ns 32466374 + +bm_rtl::function__ErasedReturnType::get_string 34.2 ns 34.2 ns 20325951 +bm_rtl::method____ErasedReturnType::get_string 35.1 ns 35.1 ns 19870274 +bm_rtl::method____ErasedTargetType::get_string 24.3 ns 24.3 ns 29128625 +bm_rtl::method____ErasedTargetAndReturnType::get_string 36.0 ns 36.0 ns 19558210 +----------------------------------- +[2025-11-04 11:30:47] >>> Run 3: workload scale = 1 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 1 iterations +============================================= + +2025-11-04T11:30:47+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.02, 0.55, 0.22 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 24.0 ns 24.0 ns 29170635 + +bm_call::via_function_ptr__Function::set_string 23.5 ns 23.5 ns 29738969 +bm_call::via_function_ptr____Method::set_string 23.7 ns 23.7 ns 29340017 + +bm_std::function_calls__Function::set_string 23.7 ns 23.7 ns 29670419 +bm_std::function_calls____Method::set_string 15.2 ns 15.2 ns 46003960 + +bm_rtl::function_calls__Function::set_string 23.5 ns 23.5 ns 29709584 +bm_rtl::method_calls______Method::set_string 23.8 ns 23.8 ns 29608054 + +bm_rtl::function__ErasedReturnType::set_string 20.2 ns 20.2 ns 34607217 +bm_rtl::method____ErasedReturnType::set_string 20.3 ns 20.3 ns 34461009 +bm_rtl::method____ErasedTargetType::set_string 26.1 ns 26.1 ns 26810310 +bm_rtl::method____ErasedTargetAndReturnType::set_string 26.1 ns 26.1 ns 26832712 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 32.8 ns 32.8 ns 21350792 + +bm_call::via_function_ptr__Function::get_string 32.4 ns 32.4 ns 21599677 +bm_call::via_function_ptr____Method::get_string 32.6 ns 32.6 ns 21499549 + +bm_std::function_calls__Function::get_string 32.6 ns 32.6 ns 21435275 +bm_std::function_calls____Method::get_string 26.5 ns 26.5 ns 26588723 + +bm_rtl::function_calls__Function::get_string 32.4 ns 32.4 ns 21569659 +bm_rtl::method_calls______Method::get_string 32.6 ns 32.6 ns 21481163 + +bm_rtl::function__ErasedReturnType::get_string 35.0 ns 35.0 ns 20082606 +bm_rtl::method____ErasedReturnType::get_string 45.6 ns 45.6 ns 15272559 +bm_rtl::method____ErasedTargetType::get_string 32.7 ns 32.7 ns 21388794 +bm_rtl::method____ErasedTargetAndReturnType::get_string 37.5 ns 37.5 ns 18706136 +----------------------------------- +[2025-11-04 11:31:10] >>> Run 1: workload scale = 5 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 5 iterations +============================================= + +2025-11-04T11:31:10+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.01, 0.58, 0.24 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 93.8 ns 93.8 ns 7417031 + +bm_call::via_function_ptr__Function::set_string 94.0 ns 94.0 ns 7452008 +bm_call::via_function_ptr____Method::set_string 93.8 ns 93.8 ns 7473913 + +bm_std::function_calls__Function::set_string 94.1 ns 94.1 ns 7465042 +bm_std::function_calls____Method::set_string 94.1 ns 94.1 ns 7427433 + +bm_rtl::function_calls__Function::set_string 93.9 ns 93.9 ns 7491989 +bm_rtl::method_calls______Method::set_string 94.3 ns 94.3 ns 7440296 + +bm_rtl::function__ErasedReturnType::set_string 95.6 ns 95.6 ns 7316655 +bm_rtl::method____ErasedReturnType::set_string 96.8 ns 96.8 ns 7149766 +bm_rtl::method____ErasedTargetType::set_string 97.4 ns 97.4 ns 7189451 +bm_rtl::method____ErasedTargetAndReturnType::set_string 103 ns 103 ns 6771417 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 115 ns 116 ns 6045433 + +bm_call::via_function_ptr__Function::get_string 115 ns 115 ns 6052590 +bm_call::via_function_ptr____Method::get_string 115 ns 115 ns 6090268 + +bm_std::function_calls__Function::get_string 115 ns 115 ns 6074354 +bm_std::function_calls____Method::get_string 115 ns 115 ns 6102339 + +bm_rtl::function_calls__Function::get_string 115 ns 115 ns 6077686 +bm_rtl::method_calls______Method::get_string 115 ns 115 ns 6086147 + +bm_rtl::function__ErasedReturnType::get_string 125 ns 125 ns 5583022 +bm_rtl::method____ErasedReturnType::get_string 125 ns 125 ns 5606210 +bm_rtl::method____ErasedTargetType::get_string 116 ns 116 ns 6030406 +bm_rtl::method____ErasedTargetAndReturnType::get_string 127 ns 127 ns 5496168 +----------------------------------- +[2025-11-04 11:31:28] >>> Run 2: workload scale = 5 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 5 iterations +============================================= + +2025-11-04T11:31:28+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.01, 0.61, 0.26 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 93.9 ns 93.9 ns 7413892 + +bm_call::via_function_ptr__Function::set_string 93.6 ns 93.6 ns 7458233 +bm_call::via_function_ptr____Method::set_string 93.6 ns 93.6 ns 7470144 + +bm_std::function_calls__Function::set_string 93.7 ns 93.7 ns 7426724 +bm_std::function_calls____Method::set_string 94.1 ns 94.1 ns 7412709 + +bm_rtl::function_calls__Function::set_string 93.7 ns 93.7 ns 7485217 +bm_rtl::method_calls______Method::set_string 94.1 ns 94.1 ns 7455729 + +bm_rtl::function__ErasedReturnType::set_string 95.7 ns 95.7 ns 7312618 +bm_rtl::method____ErasedReturnType::set_string 96.7 ns 96.7 ns 7219262 +bm_rtl::method____ErasedTargetType::set_string 97.6 ns 97.6 ns 7145010 +bm_rtl::method____ErasedTargetAndReturnType::set_string 103 ns 103 ns 6807671 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 116 ns 116 ns 6072780 + +bm_call::via_function_ptr__Function::get_string 115 ns 115 ns 6034419 +bm_call::via_function_ptr____Method::get_string 115 ns 115 ns 6080424 + +bm_std::function_calls__Function::get_string 115 ns 115 ns 6047388 +bm_std::function_calls____Method::get_string 115 ns 115 ns 6093462 + +bm_rtl::function_calls__Function::get_string 115 ns 115 ns 6097576 +bm_rtl::method_calls______Method::get_string 115 ns 115 ns 6098871 + +bm_rtl::function__ErasedReturnType::get_string 125 ns 125 ns 5597537 +bm_rtl::method____ErasedReturnType::get_string 126 ns 126 ns 5581065 +bm_rtl::method____ErasedTargetType::get_string 116 ns 116 ns 6036900 +bm_rtl::method____ErasedTargetAndReturnType::get_string 127 ns 127 ns 5516757 +----------------------------------- +[2025-11-04 11:31:46] >>> Run 3: workload scale = 5 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 5 iterations +============================================= + +2025-11-04T11:31:46+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.01, 0.63, 0.27 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 94.4 ns 94.4 ns 7268124 + +bm_call::via_function_ptr__Function::set_string 94.2 ns 94.2 ns 7461840 +bm_call::via_function_ptr____Method::set_string 94.2 ns 94.2 ns 7427933 + +bm_std::function_calls__Function::set_string 94.5 ns 94.5 ns 7422218 +bm_std::function_calls____Method::set_string 94.6 ns 94.6 ns 7430982 + +bm_rtl::function_calls__Function::set_string 94.5 ns 94.5 ns 7430754 +bm_rtl::method_calls______Method::set_string 94.7 ns 94.8 ns 7407535 + +bm_rtl::function__ErasedReturnType::set_string 96.1 ns 96.1 ns 7196656 +bm_rtl::method____ErasedReturnType::set_string 96.9 ns 96.9 ns 7211863 +bm_rtl::method____ErasedTargetType::set_string 97.0 ns 97.0 ns 7195465 +bm_rtl::method____ErasedTargetAndReturnType::set_string 102 ns 102 ns 6818975 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 115 ns 115 ns 6065805 + +bm_call::via_function_ptr__Function::get_string 115 ns 115 ns 6096645 +bm_call::via_function_ptr____Method::get_string 115 ns 115 ns 6071541 + +bm_std::function_calls__Function::get_string 116 ns 116 ns 6047175 +bm_std::function_calls____Method::get_string 115 ns 115 ns 6060394 + +bm_rtl::function_calls__Function::get_string 115 ns 115 ns 6075944 +bm_rtl::method_calls______Method::get_string 115 ns 115 ns 6079330 + +bm_rtl::function__ErasedReturnType::get_string 125 ns 125 ns 5584045 +bm_rtl::method____ErasedReturnType::get_string 126 ns 126 ns 5557081 +bm_rtl::method____ErasedTargetType::get_string 117 ns 117 ns 5989672 +bm_rtl::method____ErasedTargetAndReturnType::get_string 128 ns 128 ns 5499308 +----------------------------------- +[2025-11-04 11:32:04] >>> Run 1: workload scale = 10 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 10 iterations +============================================= + +2025-11-04T11:32:04+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 0.65, 0.29 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 161 ns 161 ns 4332878 + +bm_call::via_function_ptr__Function::set_string 161 ns 161 ns 4416633 +bm_call::via_function_ptr____Method::set_string 160 ns 160 ns 4399361 + +bm_std::function_calls__Function::set_string 161 ns 161 ns 4305144 +bm_std::function_calls____Method::set_string 161 ns 161 ns 4342427 + +bm_rtl::function_calls__Function::set_string 161 ns 161 ns 4357679 +bm_rtl::method_calls______Method::set_string 160 ns 160 ns 4336485 + +bm_rtl::function__ErasedReturnType::set_string 164 ns 164 ns 4290751 +bm_rtl::method____ErasedReturnType::set_string 164 ns 164 ns 4305488 +bm_rtl::method____ErasedTargetType::set_string 165 ns 165 ns 4271135 +bm_rtl::method____ErasedTargetAndReturnType::set_string 171 ns 171 ns 4087737 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 209 ns 209 ns 3342955 + +bm_call::via_function_ptr__Function::get_string 210 ns 210 ns 3341236 +bm_call::via_function_ptr____Method::get_string 209 ns 209 ns 3340519 + +bm_std::function_calls__Function::get_string 209 ns 209 ns 3329193 +bm_std::function_calls____Method::get_string 209 ns 209 ns 3334552 + +bm_rtl::function_calls__Function::get_string 210 ns 210 ns 3341471 +bm_rtl::method_calls______Method::get_string 210 ns 210 ns 3317212 + +bm_rtl::function__ErasedReturnType::get_string 217 ns 217 ns 3257317 +bm_rtl::method____ErasedReturnType::get_string 218 ns 218 ns 3238960 +bm_rtl::method____ErasedTargetType::get_string 212 ns 212 ns 3304550 +bm_rtl::method____ErasedTargetAndReturnType::get_string 218 ns 218 ns 3228561 +----------------------------------- +[2025-11-04 11:32:24] >>> Run 2: workload scale = 10 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 10 iterations +============================================= + +2025-11-04T11:32:24+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 2413.91 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 0.67, 0.30 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 163 ns 163 ns 4302963 + +bm_call::via_function_ptr__Function::set_string 164 ns 164 ns 4290635 +bm_call::via_function_ptr____Method::set_string 164 ns 164 ns 4255706 + +bm_std::function_calls__Function::set_string 163 ns 163 ns 4297600 +bm_std::function_calls____Method::set_string 163 ns 163 ns 4369051 + +bm_rtl::function_calls__Function::set_string 163 ns 163 ns 4271991 +bm_rtl::method_calls______Method::set_string 163 ns 163 ns 4317493 + +bm_rtl::function__ErasedReturnType::set_string 165 ns 165 ns 4257845 +bm_rtl::method____ErasedReturnType::set_string 164 ns 164 ns 4253764 +bm_rtl::method____ErasedTargetType::set_string 167 ns 167 ns 4215960 +bm_rtl::method____ErasedTargetAndReturnType::set_string 173 ns 173 ns 4066978 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 211 ns 211 ns 3342799 + +bm_call::via_function_ptr__Function::get_string 210 ns 210 ns 3344684 +bm_call::via_function_ptr____Method::get_string 212 ns 212 ns 3308560 + +bm_std::function_calls__Function::get_string 211 ns 211 ns 3330519 +bm_std::function_calls____Method::get_string 211 ns 211 ns 3300133 + +bm_rtl::function_calls__Function::get_string 211 ns 211 ns 3302953 +bm_rtl::method_calls______Method::get_string 212 ns 212 ns 3298514 + +bm_rtl::function__ErasedReturnType::get_string 218 ns 218 ns 3215137 +bm_rtl::method____ErasedReturnType::get_string 219 ns 219 ns 3201579 +bm_rtl::method____ErasedTargetType::get_string 214 ns 214 ns 3298595 +bm_rtl::method____ErasedTargetAndReturnType::get_string 219 ns 219 ns 3203336 +----------------------------------- +[2025-11-04 11:32:44] >>> Run 3: workload scale = 10 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 10 iterations +============================================= + +2025-11-04T11:32:44+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 4877.87 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 0.70, 0.32 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 162 ns 162 ns 4338121 + +bm_call::via_function_ptr__Function::set_string 163 ns 163 ns 4377872 +bm_call::via_function_ptr____Method::set_string 161 ns 161 ns 4352982 + +bm_std::function_calls__Function::set_string 161 ns 161 ns 4421243 +bm_std::function_calls____Method::set_string 161 ns 161 ns 4359250 + +bm_rtl::function_calls__Function::set_string 161 ns 161 ns 4315918 +bm_rtl::method_calls______Method::set_string 161 ns 161 ns 4328071 + +bm_rtl::function__ErasedReturnType::set_string 164 ns 164 ns 4284932 +bm_rtl::method____ErasedReturnType::set_string 164 ns 164 ns 4272614 +bm_rtl::method____ErasedTargetType::set_string 165 ns 165 ns 4233649 +bm_rtl::method____ErasedTargetAndReturnType::set_string 171 ns 171 ns 4102406 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 209 ns 209 ns 3346131 + +bm_call::via_function_ptr__Function::get_string 210 ns 210 ns 3324956 +bm_call::via_function_ptr____Method::get_string 211 ns 211 ns 3317701 + +bm_std::function_calls__Function::get_string 210 ns 210 ns 3332691 +bm_std::function_calls____Method::get_string 210 ns 210 ns 3329162 + +bm_rtl::function_calls__Function::get_string 209 ns 209 ns 3294911 +bm_rtl::method_calls______Method::get_string 211 ns 211 ns 3331679 + +bm_rtl::function__ErasedReturnType::get_string 215 ns 216 ns 3244227 +bm_rtl::method____ErasedReturnType::get_string 216 ns 216 ns 3251398 +bm_rtl::method____ErasedTargetType::get_string 210 ns 210 ns 3351688 +bm_rtl::method____ErasedTargetAndReturnType::get_string 216 ns 216 ns 3247038 +----------------------------------- +[2025-11-04 11:33:04] >>> Run 1: workload scale = 15 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 15 iterations +============================================= + +2025-11-04T11:33:04+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 0.72, 0.33 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 194 ns 194 ns 3624354 + +bm_call::via_function_ptr__Function::set_string 194 ns 194 ns 3627036 +bm_call::via_function_ptr____Method::set_string 195 ns 195 ns 3601256 + +bm_std::function_calls__Function::set_string 194 ns 194 ns 3589830 +bm_std::function_calls____Method::set_string 194 ns 194 ns 3637376 + +bm_rtl::function_calls__Function::set_string 194 ns 194 ns 3638687 +bm_rtl::method_calls______Method::set_string 195 ns 195 ns 3599993 + +bm_rtl::function__ErasedReturnType::set_string 196 ns 196 ns 3578184 +bm_rtl::method____ErasedReturnType::set_string 197 ns 197 ns 3547623 +bm_rtl::method____ErasedTargetType::set_string 198 ns 198 ns 3539370 +bm_rtl::method____ErasedTargetAndReturnType::set_string 203 ns 203 ns 3430347 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 271 ns 271 ns 2477136 + +bm_call::via_function_ptr__Function::get_string 254 ns 254 ns 2745060 +bm_call::via_function_ptr____Method::get_string 253 ns 253 ns 2760175 + +bm_std::function_calls__Function::get_string 253 ns 253 ns 2742774 +bm_std::function_calls____Method::get_string 253 ns 253 ns 2748295 + +bm_rtl::function_calls__Function::get_string 252 ns 252 ns 2791858 +bm_rtl::method_calls______Method::get_string 252 ns 252 ns 2745882 + +bm_rtl::function__ErasedReturnType::get_string 258 ns 258 ns 2714931 +bm_rtl::method____ErasedReturnType::get_string 259 ns 259 ns 2686641 +bm_rtl::method____ErasedTargetType::get_string 252 ns 252 ns 2771666 +bm_rtl::method____ErasedTargetAndReturnType::get_string 260 ns 260 ns 2687541 +----------------------------------- +[2025-11-04 11:33:25] >>> Run 2: workload scale = 15 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 15 iterations +============================================= + +2025-11-04T11:33:25+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 799.812 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 0.74, 0.35 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 211 ns 211 ns 3320178 + +bm_call::via_function_ptr__Function::set_string 212 ns 212 ns 3321160 +bm_call::via_function_ptr____Method::set_string 211 ns 211 ns 3335082 + +bm_std::function_calls__Function::set_string 212 ns 212 ns 3308055 +bm_std::function_calls____Method::set_string 211 ns 211 ns 3304941 + +bm_rtl::function_calls__Function::set_string 212 ns 212 ns 3304781 +bm_rtl::method_calls______Method::set_string 213 ns 213 ns 3303226 + +bm_rtl::function__ErasedReturnType::set_string 214 ns 214 ns 3258122 +bm_rtl::method____ErasedReturnType::set_string 214 ns 214 ns 3264878 +bm_rtl::method____ErasedTargetType::set_string 216 ns 216 ns 3251560 +bm_rtl::method____ErasedTargetAndReturnType::set_string 218 ns 218 ns 3207293 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 293 ns 293 ns 2384492 + +bm_call::via_function_ptr__Function::get_string 293 ns 293 ns 2407150 +bm_call::via_function_ptr____Method::get_string 294 ns 294 ns 2380693 + +bm_std::function_calls__Function::get_string 295 ns 295 ns 2398510 +bm_std::function_calls____Method::get_string 292 ns 292 ns 2407469 + +bm_rtl::function_calls__Function::get_string 293 ns 293 ns 2396622 +bm_rtl::method_calls______Method::get_string 292 ns 292 ns 2398263 + +bm_rtl::function__ErasedReturnType::get_string 297 ns 297 ns 2353980 +bm_rtl::method____ErasedReturnType::get_string 299 ns 299 ns 2337886 +bm_rtl::method____ErasedTargetType::get_string 295 ns 295 ns 2380052 +bm_rtl::method____ErasedTargetAndReturnType::get_string 302 ns 302 ns 2319651 +----------------------------------- +[2025-11-04 11:33:46] >>> Run 3: workload scale = 15 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 15 iterations +============================================= + +2025-11-04T11:33:46+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.06, 0.77, 0.37 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 194 ns 194 ns 3620973 + +bm_call::via_function_ptr__Function::set_string 193 ns 193 ns 3638599 +bm_call::via_function_ptr____Method::set_string 193 ns 193 ns 3638008 + +bm_std::function_calls__Function::set_string 194 ns 194 ns 3628619 +bm_std::function_calls____Method::set_string 194 ns 194 ns 3577027 + +bm_rtl::function_calls__Function::set_string 194 ns 194 ns 3633217 +bm_rtl::method_calls______Method::set_string 195 ns 195 ns 3607754 + +bm_rtl::function__ErasedReturnType::set_string 194 ns 194 ns 3603029 +bm_rtl::method____ErasedReturnType::set_string 196 ns 196 ns 3592022 +bm_rtl::method____ErasedTargetType::set_string 197 ns 197 ns 3535375 +bm_rtl::method____ErasedTargetAndReturnType::set_string 203 ns 203 ns 3455803 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 251 ns 251 ns 2770899 + +bm_call::via_function_ptr__Function::get_string 252 ns 252 ns 2787847 +bm_call::via_function_ptr____Method::get_string 255 ns 255 ns 2794390 + +bm_std::function_calls__Function::get_string 252 ns 252 ns 2783053 +bm_std::function_calls____Method::get_string 254 ns 254 ns 2762588 + +bm_rtl::function_calls__Function::get_string 251 ns 251 ns 2750173 +bm_rtl::method_calls______Method::get_string 254 ns 254 ns 2780142 + +bm_rtl::function__ErasedReturnType::get_string 258 ns 258 ns 2713804 +bm_rtl::method____ErasedReturnType::get_string 259 ns 259 ns 2681868 +bm_rtl::method____ErasedTargetType::get_string 254 ns 254 ns 2774394 +bm_rtl::method____ErasedTargetAndReturnType::get_string 260 ns 260 ns 2703368 +----------------------------------- +[2025-11-04 11:34:07] >>> Run 1: workload scale = 20 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 20 iterations +============================================= + +2025-11-04T11:34:07+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.04, 0.79, 0.38 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 306 ns 306 ns 2290492 + +bm_call::via_function_ptr__Function::set_string 311 ns 311 ns 2241247 +bm_call::via_function_ptr____Method::set_string 313 ns 313 ns 2234098 + +bm_std::function_calls__Function::set_string 312 ns 312 ns 2234676 +bm_std::function_calls____Method::set_string 312 ns 312 ns 2241612 + +bm_rtl::function_calls__Function::set_string 312 ns 312 ns 2253856 +bm_rtl::method_calls______Method::set_string 313 ns 313 ns 2228407 + +bm_rtl::function__ErasedReturnType::set_string 308 ns 308 ns 2261970 +bm_rtl::method____ErasedReturnType::set_string 312 ns 312 ns 2245957 +bm_rtl::method____ErasedTargetType::set_string 311 ns 311 ns 2213517 +bm_rtl::method____ErasedTargetAndReturnType::set_string 314 ns 314 ns 2241483 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 443 ns 443 ns 1581839 + +bm_call::via_function_ptr__Function::get_string 451 ns 451 ns 1548794 +bm_call::via_function_ptr____Method::get_string 452 ns 452 ns 1550466 + +bm_std::function_calls__Function::get_string 452 ns 452 ns 1550969 +bm_std::function_calls____Method::get_string 447 ns 447 ns 1563335 + +bm_rtl::function_calls__Function::get_string 452 ns 452 ns 1551478 +bm_rtl::method_calls______Method::get_string 452 ns 452 ns 1548665 + +bm_rtl::function__ErasedReturnType::get_string 459 ns 459 ns 1528761 +bm_rtl::method____ErasedReturnType::get_string 459 ns 459 ns 1522846 +bm_rtl::method____ErasedTargetType::get_string 449 ns 449 ns 1559946 +bm_rtl::method____ErasedTargetAndReturnType::get_string 468 ns 468 ns 1496384 +----------------------------------- +[2025-11-04 11:34:32] >>> Run 2: workload scale = 20 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 20 iterations +============================================= + +2025-11-04T11:34:32+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.03, 0.80, 0.40 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 272 ns 272 ns 2558705 + +bm_call::via_function_ptr__Function::set_string 272 ns 272 ns 2566816 +bm_call::via_function_ptr____Method::set_string 273 ns 273 ns 2560637 + +bm_std::function_calls__Function::set_string 270 ns 270 ns 2573221 +bm_std::function_calls____Method::set_string 273 ns 273 ns 2573250 + +bm_rtl::function_calls__Function::set_string 272 ns 272 ns 2575772 +bm_rtl::method_calls______Method::set_string 274 ns 274 ns 2567684 + +bm_rtl::function__ErasedReturnType::set_string 276 ns 276 ns 2525378 +bm_rtl::method____ErasedReturnType::set_string 277 ns 277 ns 2554199 +bm_rtl::method____ErasedTargetType::set_string 275 ns 275 ns 2561448 +bm_rtl::method____ErasedTargetAndReturnType::set_string 282 ns 282 ns 2483219 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 381 ns 381 ns 1842934 + +bm_call::via_function_ptr__Function::get_string 386 ns 386 ns 1819888 +bm_call::via_function_ptr____Method::get_string 384 ns 384 ns 1818988 + +bm_std::function_calls__Function::get_string 385 ns 385 ns 1814239 +bm_std::function_calls____Method::get_string 386 ns 386 ns 1810637 + +bm_rtl::function_calls__Function::get_string 385 ns 385 ns 1821229 +bm_rtl::method_calls______Method::get_string 387 ns 387 ns 1815740 + +bm_rtl::function__ErasedReturnType::get_string 401 ns 401 ns 1742383 +bm_rtl::method____ErasedReturnType::get_string 402 ns 402 ns 1744796 +bm_rtl::method____ErasedTargetType::get_string 391 ns 391 ns 1786914 +bm_rtl::method____ErasedTargetAndReturnType::get_string 402 ns 403 ns 1734389 +----------------------------------- +[2025-11-04 11:34:55] >>> Run 3: workload scale = 20 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 20 iterations +============================================= + +2025-11-04T11:34:55+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 1003.07 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.02, 0.82, 0.42 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 273 ns 273 ns 2555885 + +bm_call::via_function_ptr__Function::set_string 273 ns 273 ns 2520891 +bm_call::via_function_ptr____Method::set_string 273 ns 273 ns 2549459 + +bm_std::function_calls__Function::set_string 273 ns 273 ns 2576378 +bm_std::function_calls____Method::set_string 273 ns 273 ns 2571194 + +bm_rtl::function_calls__Function::set_string 274 ns 274 ns 2506842 +bm_rtl::method_calls______Method::set_string 274 ns 274 ns 2574283 + +bm_rtl::function__ErasedReturnType::set_string 278 ns 278 ns 2531104 +bm_rtl::method____ErasedReturnType::set_string 275 ns 275 ns 2543654 +bm_rtl::method____ErasedTargetType::set_string 274 ns 274 ns 2532744 +bm_rtl::method____ErasedTargetAndReturnType::set_string 284 ns 284 ns 2459606 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 384 ns 384 ns 1816058 + +bm_call::via_function_ptr__Function::get_string 388 ns 388 ns 1807084 +bm_call::via_function_ptr____Method::get_string 388 ns 388 ns 1802275 + +bm_std::function_calls__Function::get_string 386 ns 386 ns 1800274 +bm_std::function_calls____Method::get_string 387 ns 387 ns 1809751 + +bm_rtl::function_calls__Function::get_string 388 ns 388 ns 1809043 +bm_rtl::method_calls______Method::get_string 388 ns 388 ns 1807297 + +bm_rtl::function__ErasedReturnType::get_string 403 ns 403 ns 1733679 +bm_rtl::method____ErasedReturnType::get_string 402 ns 402 ns 1738530 +bm_rtl::method____ErasedTargetType::get_string 392 ns 392 ns 1778195 +bm_rtl::method____ErasedTargetAndReturnType::get_string 404 ns 404 ns 1736458 +----------------------------------- +[2025-11-04 11:35:19] >>> Run 1: workload scale = 25 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 25 iterations +============================================= + +2025-11-04T11:35:19+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.01, 0.84, 0.43 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 308 ns 308 ns 2289455 + +bm_call::via_function_ptr__Function::set_string 308 ns 308 ns 2295086 +bm_call::via_function_ptr____Method::set_string 305 ns 305 ns 2282996 + +bm_std::function_calls__Function::set_string 306 ns 306 ns 2287656 +bm_std::function_calls____Method::set_string 305 ns 305 ns 2290493 + +bm_rtl::function_calls__Function::set_string 306 ns 306 ns 2293649 +bm_rtl::method_calls______Method::set_string 308 ns 308 ns 2263061 + +bm_rtl::function__ErasedReturnType::set_string 310 ns 310 ns 2270433 +bm_rtl::method____ErasedReturnType::set_string 322 ns 322 ns 2184471 +bm_rtl::method____ErasedTargetType::set_string 311 ns 311 ns 2252261 +bm_rtl::method____ErasedTargetAndReturnType::set_string 318 ns 318 ns 2177221 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 449 ns 449 ns 1556063 + +bm_call::via_function_ptr__Function::get_string 449 ns 449 ns 1558473 +bm_call::via_function_ptr____Method::get_string 450 ns 450 ns 1553390 + +bm_std::function_calls__Function::get_string 451 ns 451 ns 1557283 +bm_std::function_calls____Method::get_string 452 ns 452 ns 1544521 + +bm_rtl::function_calls__Function::get_string 451 ns 451 ns 1549646 +bm_rtl::method_calls______Method::get_string 450 ns 450 ns 1547760 + +bm_rtl::function__ErasedReturnType::get_string 468 ns 468 ns 1489242 +bm_rtl::method____ErasedReturnType::get_string 469 ns 469 ns 1493530 +bm_rtl::method____ErasedTargetType::get_string 457 ns 457 ns 1534035 +bm_rtl::method____ErasedTargetAndReturnType::get_string 471 ns 471 ns 1482462 +----------------------------------- +[2025-11-04 11:35:44] >>> Run 2: workload scale = 25 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 25 iterations +============================================= + +2025-11-04T11:35:44+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.01, 0.85, 0.45 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 310 ns 310 ns 2249513 + +bm_call::via_function_ptr__Function::set_string 309 ns 309 ns 2268930 +bm_call::via_function_ptr____Method::set_string 311 ns 311 ns 2250980 + +bm_std::function_calls__Function::set_string 310 ns 310 ns 2266376 +bm_std::function_calls____Method::set_string 310 ns 310 ns 2268158 + +bm_rtl::function_calls__Function::set_string 312 ns 312 ns 2263713 +bm_rtl::method_calls______Method::set_string 310 ns 310 ns 2262103 + +bm_rtl::function__ErasedReturnType::set_string 315 ns 315 ns 2229881 +bm_rtl::method____ErasedReturnType::set_string 315 ns 315 ns 2221153 +bm_rtl::method____ErasedTargetType::set_string 311 ns 311 ns 2246314 +bm_rtl::method____ErasedTargetAndReturnType::set_string 321 ns 321 ns 2167043 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 448 ns 448 ns 1561857 + +bm_call::via_function_ptr__Function::get_string 448 ns 448 ns 1559884 +bm_call::via_function_ptr____Method::get_string 450 ns 450 ns 1556156 + +bm_std::function_calls__Function::get_string 447 ns 447 ns 1561230 +bm_std::function_calls____Method::get_string 451 ns 451 ns 1549786 + +bm_rtl::function_calls__Function::get_string 448 ns 448 ns 1563251 +bm_rtl::method_calls______Method::get_string 450 ns 450 ns 1554882 + +bm_rtl::function__ErasedReturnType::get_string 468 ns 468 ns 1495466 +bm_rtl::method____ErasedReturnType::get_string 468 ns 468 ns 1496289 +bm_rtl::method____ErasedTargetType::get_string 456 ns 456 ns 1536797 +bm_rtl::method____ErasedTargetAndReturnType::get_string 470 ns 470 ns 1492470 +----------------------------------- +[2025-11-04 11:36:08] >>> Run 3: workload scale = 25 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 25 iterations +============================================= + +2025-11-04T11:36:08+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 0.86, 0.47 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 339 ns 339 ns 2075571 + +bm_call::via_function_ptr__Function::set_string 339 ns 339 ns 2066316 +bm_call::via_function_ptr____Method::set_string 339 ns 339 ns 2068331 + +bm_std::function_calls__Function::set_string 339 ns 339 ns 2063704 +bm_std::function_calls____Method::set_string 340 ns 340 ns 2055163 + +bm_rtl::function_calls__Function::set_string 339 ns 339 ns 2070474 +bm_rtl::method_calls______Method::set_string 338 ns 338 ns 2054751 + +bm_rtl::function__ErasedReturnType::set_string 342 ns 342 ns 2041861 +bm_rtl::method____ErasedReturnType::set_string 344 ns 344 ns 2032415 +bm_rtl::method____ErasedTargetType::set_string 344 ns 344 ns 2041850 +bm_rtl::method____ErasedTargetAndReturnType::set_string 346 ns 346 ns 2021772 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 508 ns 508 ns 1375311 + +bm_call::via_function_ptr__Function::get_string 508 ns 508 ns 1377949 +bm_call::via_function_ptr____Method::get_string 508 ns 508 ns 1376675 + +bm_std::function_calls__Function::get_string 509 ns 509 ns 1381695 +bm_std::function_calls____Method::get_string 509 ns 509 ns 1372143 + +bm_rtl::function_calls__Function::get_string 506 ns 507 ns 1370074 +bm_rtl::method_calls______Method::get_string 509 ns 509 ns 1374760 + +bm_rtl::function__ErasedReturnType::get_string 526 ns 526 ns 1335483 +bm_rtl::method____ErasedReturnType::get_string 524 ns 524 ns 1334099 +bm_rtl::method____ErasedTargetType::get_string 516 ns 516 ns 1364756 +bm_rtl::method____ErasedTargetAndReturnType::get_string 526 ns 526 ns 1332934 +----------------------------------- +[2025-11-04 11:36:29] >>> Run 1: workload scale = 30 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 30 iterations +============================================= + +2025-11-04T11:36:29+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 0.87, 0.48 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 369 ns 369 ns 1897874 + +bm_call::via_function_ptr__Function::set_string 368 ns 368 ns 1913102 +bm_call::via_function_ptr____Method::set_string 369 ns 369 ns 1901147 + +bm_std::function_calls__Function::set_string 367 ns 367 ns 1908243 +bm_std::function_calls____Method::set_string 370 ns 370 ns 1882990 + +bm_rtl::function_calls__Function::set_string 367 ns 367 ns 1889567 +bm_rtl::method_calls______Method::set_string 367 ns 367 ns 1903609 + +bm_rtl::function__ErasedReturnType::set_string 376 ns 376 ns 1862890 +bm_rtl::method____ErasedReturnType::set_string 375 ns 375 ns 1858506 +bm_rtl::method____ErasedTargetType::set_string 380 ns 380 ns 1850619 +bm_rtl::method____ErasedTargetAndReturnType::set_string 385 ns 385 ns 1836768 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 524 ns 524 ns 1338003 + +bm_call::via_function_ptr__Function::get_string 525 ns 525 ns 1334577 +bm_call::via_function_ptr____Method::get_string 528 ns 528 ns 1335001 + +bm_std::function_calls__Function::get_string 526 ns 526 ns 1316735 +bm_std::function_calls____Method::get_string 533 ns 533 ns 1315542 + +bm_rtl::function_calls__Function::get_string 526 ns 526 ns 1333276 +bm_rtl::method_calls______Method::get_string 526 ns 526 ns 1342865 + +bm_rtl::function__ErasedReturnType::get_string 558 ns 558 ns 1248312 +bm_rtl::method____ErasedReturnType::get_string 558 ns 558 ns 1257303 +bm_rtl::method____ErasedTargetType::get_string 546 ns 546 ns 1288987 +bm_rtl::method____ErasedTargetAndReturnType::get_string 563 ns 563 ns 1246070 +----------------------------------- +[2025-11-04 11:36:49] >>> Run 2: workload scale = 30 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 30 iterations +============================================= + +2025-11-04T11:36:49+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 1873.5 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 0.88, 0.49 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 374 ns 374 ns 1879098 + +bm_call::via_function_ptr__Function::set_string 375 ns 375 ns 1876482 +bm_call::via_function_ptr____Method::set_string 375 ns 375 ns 1865772 + +bm_std::function_calls__Function::set_string 374 ns 374 ns 1878401 +bm_std::function_calls____Method::set_string 373 ns 373 ns 1886366 + +bm_rtl::function_calls__Function::set_string 374 ns 374 ns 1876114 +bm_rtl::method_calls______Method::set_string 375 ns 375 ns 1869158 + +bm_rtl::function__ErasedReturnType::set_string 397 ns 397 ns 1760547 +bm_rtl::method____ErasedReturnType::set_string 394 ns 394 ns 1778330 +bm_rtl::method____ErasedTargetType::set_string 388 ns 388 ns 1810762 +bm_rtl::method____ErasedTargetAndReturnType::set_string 403 ns 403 ns 1736610 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 525 ns 525 ns 1327945 + +bm_call::via_function_ptr__Function::get_string 529 ns 529 ns 1321273 +bm_call::via_function_ptr____Method::get_string 529 ns 530 ns 1329153 + +bm_std::function_calls__Function::get_string 528 ns 528 ns 1315558 +bm_std::function_calls____Method::get_string 532 ns 532 ns 1307079 + +bm_rtl::function_calls__Function::get_string 529 ns 529 ns 1318584 +bm_rtl::method_calls______Method::get_string 531 ns 531 ns 1310759 + +bm_rtl::function__ErasedReturnType::get_string 572 ns 572 ns 1222508 +bm_rtl::method____ErasedReturnType::get_string 566 ns 566 ns 1234666 +bm_rtl::method____ErasedTargetType::get_string 549 ns 549 ns 1271292 +bm_rtl::method____ErasedTargetAndReturnType::get_string 567 ns 567 ns 1236981 +----------------------------------- +[2025-11-04 11:37:10] >>> Run 3: workload scale = 30 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 30 iterations +============================================= + +2025-11-04T11:37:10+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 4884.35 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 0.89, 0.50 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 373 ns 373 ns 1882535 + +bm_call::via_function_ptr__Function::set_string 370 ns 370 ns 1883841 +bm_call::via_function_ptr____Method::set_string 370 ns 370 ns 1885110 + +bm_std::function_calls__Function::set_string 368 ns 368 ns 1888699 +bm_std::function_calls____Method::set_string 373 ns 373 ns 1885554 + +bm_rtl::function_calls__Function::set_string 370 ns 370 ns 1903630 +bm_rtl::method_calls______Method::set_string 369 ns 369 ns 1891577 + +bm_rtl::function__ErasedReturnType::set_string 377 ns 377 ns 1854098 +bm_rtl::method____ErasedReturnType::set_string 378 ns 378 ns 1851962 +bm_rtl::method____ErasedTargetType::set_string 382 ns 382 ns 1839652 +bm_rtl::method____ErasedTargetAndReturnType::set_string 411 ns 411 ns 1708015 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 588 ns 588 ns 1193909 + +bm_call::via_function_ptr__Function::get_string 591 ns 591 ns 1184323 +bm_call::via_function_ptr____Method::get_string 590 ns 590 ns 1182298 + +bm_std::function_calls__Function::get_string 591 ns 591 ns 1191866 +bm_std::function_calls____Method::get_string 594 ns 594 ns 1174765 + +bm_rtl::function_calls__Function::get_string 591 ns 591 ns 1187334 +bm_rtl::method_calls______Method::get_string 590 ns 591 ns 1188320 + +bm_rtl::function__ErasedReturnType::get_string 627 ns 627 ns 1104635 +bm_rtl::method____ErasedReturnType::get_string 624 ns 624 ns 1123294 +bm_rtl::method____ErasedTargetType::get_string 612 ns 612 ns 1142836 +bm_rtl::method____ErasedTargetAndReturnType::get_string 628 ns 628 ns 1114390 +----------------------------------- +[2025-11-04 11:37:31] >>> Run 1: workload scale = 35 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 35 iterations +============================================= + +2025-11-04T11:37:31+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 4879.57 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 0.90, 0.51 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 737 ns 737 ns 949233 + +bm_call::via_function_ptr__Function::set_string 744 ns 744 ns 940157 +bm_call::via_function_ptr____Method::set_string 739 ns 739 ns 947272 + +bm_std::function_calls__Function::set_string 743 ns 743 ns 940579 +bm_std::function_calls____Method::set_string 750 ns 750 ns 931994 + +bm_rtl::function_calls__Function::set_string 743 ns 743 ns 942206 +bm_rtl::method_calls______Method::set_string 740 ns 739 ns 947113 + +bm_rtl::function__ErasedReturnType::set_string 751 ns 751 ns 932672 +bm_rtl::method____ErasedReturnType::set_string 753 ns 753 ns 930104 +bm_rtl::method____ErasedTargetType::set_string 758 ns 758 ns 910359 +bm_rtl::method____ErasedTargetAndReturnType::set_string 758 ns 758 ns 922853 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 941 ns 941 ns 747998 + +bm_call::via_function_ptr__Function::get_string 941 ns 941 ns 744259 +bm_call::via_function_ptr____Method::get_string 942 ns 942 ns 743961 + +bm_std::function_calls__Function::get_string 942 ns 942 ns 736240 +bm_std::function_calls____Method::get_string 948 ns 948 ns 737759 + +bm_rtl::function_calls__Function::get_string 944 ns 944 ns 742616 +bm_rtl::method_calls______Method::get_string 944 ns 944 ns 741708 + +bm_rtl::function__ErasedReturnType::get_string 977 ns 977 ns 716160 +bm_rtl::method____ErasedReturnType::get_string 982 ns 982 ns 707304 +bm_rtl::method____ErasedTargetType::get_string 968 ns 968 ns 723075 +bm_rtl::method____ErasedTargetAndReturnType::get_string 989 ns 989 ns 709624 +----------------------------------- +[2025-11-04 11:37:48] >>> Run 2: workload scale = 35 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 35 iterations +============================================= + +2025-11-04T11:37:48+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 0.91, 0.53 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 696 ns 696 ns 997945 + +bm_call::via_function_ptr__Function::set_string 696 ns 696 ns 1008698 +bm_call::via_function_ptr____Method::set_string 697 ns 697 ns 1006462 + +bm_std::function_calls__Function::set_string 696 ns 696 ns 1006201 +bm_std::function_calls____Method::set_string 700 ns 700 ns 1001226 + +bm_rtl::function_calls__Function::set_string 697 ns 697 ns 1006362 +bm_rtl::method_calls______Method::set_string 697 ns 697 ns 1006337 + +bm_rtl::function__ErasedReturnType::set_string 710 ns 710 ns 988589 +bm_rtl::method____ErasedReturnType::set_string 709 ns 709 ns 984855 +bm_rtl::method____ErasedTargetType::set_string 715 ns 712 ns 981415 +bm_rtl::method____ErasedTargetAndReturnType::set_string 723 ns 719 ns 972341 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 905 ns 901 ns 777630 + +bm_call::via_function_ptr__Function::get_string 904 ns 900 ns 777827 +bm_call::via_function_ptr____Method::get_string 905 ns 901 ns 776675 + +bm_std::function_calls__Function::get_string 904 ns 900 ns 777750 +bm_std::function_calls____Method::get_string 910 ns 906 ns 772493 + +bm_rtl::function_calls__Function::get_string 903 ns 899 ns 777881 +bm_rtl::method_calls______Method::get_string 905 ns 901 ns 776797 + +bm_rtl::function__ErasedReturnType::get_string 949 ns 945 ns 739878 +bm_rtl::method____ErasedReturnType::get_string 951 ns 948 ns 738968 +bm_rtl::method____ErasedTargetType::get_string 928 ns 925 ns 757011 +bm_rtl::method____ErasedTargetAndReturnType::get_string 965 ns 962 ns 727928 +----------------------------------- +[2025-11-04 11:38:06] >>> Run 3: workload scale = 35 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 35 iterations +============================================= + +2025-11-04T11:38:06+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 1390.47 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 0.91, 0.53 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 685 ns 682 ns 1018054 + +bm_call::via_function_ptr__Function::set_string 690 ns 687 ns 1016613 +bm_call::via_function_ptr____Method::set_string 687 ns 685 ns 1020388 + +bm_std::function_calls__Function::set_string 689 ns 686 ns 1019090 +bm_std::function_calls____Method::set_string 696 ns 694 ns 1009476 + +bm_rtl::function_calls__Function::set_string 691 ns 688 ns 1010954 +bm_rtl::method_calls______Method::set_string 688 ns 685 ns 1021430 + +bm_rtl::function__ErasedReturnType::set_string 700 ns 698 ns 1002649 +bm_rtl::method____ErasedReturnType::set_string 704 ns 702 ns 997297 +bm_rtl::method____ErasedTargetType::set_string 705 ns 702 ns 998683 +bm_rtl::method____ErasedTargetAndReturnType::set_string 711 ns 709 ns 986675 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 906 ns 903 ns 776326 + +bm_call::via_function_ptr__Function::get_string 906 ns 903 ns 774790 +bm_call::via_function_ptr____Method::get_string 906 ns 904 ns 774417 + +bm_std::function_calls__Function::get_string 906 ns 903 ns 773345 +bm_std::function_calls____Method::get_string 914 ns 912 ns 768527 + +bm_rtl::function_calls__Function::get_string 905 ns 903 ns 775225 +bm_rtl::method_calls______Method::get_string 906 ns 903 ns 775504 + +bm_rtl::function__ErasedReturnType::get_string 947 ns 945 ns 740012 +bm_rtl::method____ErasedReturnType::get_string 947 ns 944 ns 742160 +bm_rtl::method____ErasedTargetType::get_string 929 ns 926 ns 755413 +bm_rtl::method____ErasedTargetAndReturnType::get_string 953 ns 950 ns 737066 +----------------------------------- +[2025-11-04 11:38:23] >>> Run 1: workload scale = 40 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 40 iterations +============================================= + +2025-11-04T11:38:23+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 0.92, 0.55 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 800 ns 799 ns 867264 + +bm_call::via_function_ptr__Function::set_string 798 ns 796 ns 880085 +bm_call::via_function_ptr____Method::set_string 799 ns 797 ns 880685 + +bm_std::function_calls__Function::set_string 797 ns 795 ns 880499 +bm_std::function_calls____Method::set_string 809 ns 807 ns 866812 + +bm_rtl::function_calls__Function::set_string 796 ns 794 ns 883223 +bm_rtl::method_calls______Method::set_string 799 ns 797 ns 876599 + +bm_rtl::function__ErasedReturnType::set_string 812 ns 810 ns 861595 +bm_rtl::method____ErasedReturnType::set_string 815 ns 813 ns 863290 +bm_rtl::method____ErasedTargetType::set_string 817 ns 815 ns 860003 +bm_rtl::method____ErasedTargetAndReturnType::set_string 825 ns 823 ns 848476 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1016 ns 1014 ns 691107 + +bm_call::via_function_ptr__Function::get_string 1018 ns 1016 ns 688866 +bm_call::via_function_ptr____Method::get_string 1017 ns 1015 ns 688426 + +bm_std::function_calls__Function::get_string 1018 ns 1016 ns 689406 +bm_std::function_calls____Method::get_string 1030 ns 1028 ns 680879 + +bm_rtl::function_calls__Function::get_string 1017 ns 1015 ns 688175 +bm_rtl::method_calls______Method::get_string 1017 ns 1016 ns 689699 + +bm_rtl::function__ErasedReturnType::get_string 1062 ns 1060 ns 660938 +bm_rtl::method____ErasedReturnType::get_string 1062 ns 1060 ns 660987 +bm_rtl::method____ErasedTargetType::get_string 1041 ns 1039 ns 674072 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1068 ns 1066 ns 655561 +----------------------------------- +[2025-11-04 11:38:41] >>> Run 2: workload scale = 40 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 40 iterations +============================================= + +2025-11-04T11:38:41+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 1231.43 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 0.92, 0.55 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 788 ns 786 ns 878975 + +bm_call::via_function_ptr__Function::set_string 788 ns 787 ns 886890 +bm_call::via_function_ptr____Method::set_string 789 ns 788 ns 889408 + +bm_std::function_calls__Function::set_string 790 ns 789 ns 890087 +bm_std::function_calls____Method::set_string 793 ns 792 ns 881178 + +bm_rtl::function_calls__Function::set_string 789 ns 787 ns 889915 +bm_rtl::method_calls______Method::set_string 788 ns 787 ns 885010 + +bm_rtl::function__ErasedReturnType::set_string 798 ns 797 ns 876161 +bm_rtl::method____ErasedReturnType::set_string 797 ns 796 ns 878707 +bm_rtl::method____ErasedTargetType::set_string 800 ns 799 ns 876369 +bm_rtl::method____ErasedTargetAndReturnType::set_string 807 ns 806 ns 871804 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1004 ns 1003 ns 696947 + +bm_call::via_function_ptr__Function::get_string 1058 ns 1056 ns 696943 +bm_call::via_function_ptr____Method::get_string 1058 ns 1057 ns 662406 + +bm_std::function_calls__Function::get_string 1060 ns 1059 ns 661064 +bm_std::function_calls____Method::get_string 1061 ns 1060 ns 660663 + +bm_rtl::function_calls__Function::get_string 1059 ns 1057 ns 662143 +bm_rtl::method_calls______Method::get_string 1059 ns 1058 ns 661466 + +bm_rtl::function__ErasedReturnType::get_string 1097 ns 1096 ns 638879 +bm_rtl::method____ErasedReturnType::get_string 1098 ns 1097 ns 638203 +bm_rtl::method____ErasedTargetType::get_string 1076 ns 1075 ns 650820 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1101 ns 1100 ns 636763 +----------------------------------- +[2025-11-04 11:38:58] >>> Run 3: workload scale = 40 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 40 iterations +============================================= + +2025-11-04T11:38:58+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 0.93, 0.56 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 790 ns 789 ns 879491 + +bm_call::via_function_ptr__Function::set_string 801 ns 800 ns 876063 +bm_call::via_function_ptr____Method::set_string 801 ns 800 ns 875793 + +bm_std::function_calls__Function::set_string 801 ns 800 ns 867836 +bm_std::function_calls____Method::set_string 793 ns 793 ns 882424 + +bm_rtl::function_calls__Function::set_string 801 ns 800 ns 873938 +bm_rtl::method_calls______Method::set_string 800 ns 799 ns 876111 + +bm_rtl::function__ErasedReturnType::set_string 791 ns 790 ns 883758 +bm_rtl::method____ErasedReturnType::set_string 794 ns 793 ns 882458 +bm_rtl::method____ErasedTargetType::set_string 795 ns 794 ns 882106 +bm_rtl::method____ErasedTargetAndReturnType::set_string 802 ns 802 ns 875097 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1011 ns 1010 ns 691725 + +bm_call::via_function_ptr__Function::get_string 1013 ns 1012 ns 690708 +bm_call::via_function_ptr____Method::get_string 1015 ns 1014 ns 690969 + +bm_std::function_calls__Function::get_string 1014 ns 1013 ns 691823 +bm_std::function_calls____Method::get_string 1007 ns 1006 ns 696324 + +bm_rtl::function_calls__Function::get_string 1014 ns 1013 ns 690932 +bm_rtl::method_calls______Method::get_string 1016 ns 1015 ns 691167 + +bm_rtl::function__ErasedReturnType::get_string 1029 ns 1028 ns 679959 +bm_rtl::method____ErasedReturnType::get_string 1036 ns 1035 ns 676196 +bm_rtl::method____ErasedTargetType::get_string 1017 ns 1016 ns 689113 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1043 ns 1042 ns 672677 +----------------------------------- +[2025-11-04 11:39:16] >>> Run 1: workload scale = 45 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 45 iterations +============================================= + +2025-11-04T11:39:16+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 1640.45 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 0.93, 0.57 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 846 ns 846 ns 821898 + +bm_call::via_function_ptr__Function::set_string 846 ns 846 ns 829586 +bm_call::via_function_ptr____Method::set_string 847 ns 846 ns 827075 + +bm_std::function_calls__Function::set_string 848 ns 848 ns 823698 +bm_std::function_calls____Method::set_string 850 ns 849 ns 824485 + +bm_rtl::function_calls__Function::set_string 848 ns 848 ns 826498 +bm_rtl::method_calls______Method::set_string 847 ns 846 ns 826833 + +bm_rtl::function__ErasedReturnType::set_string 857 ns 857 ns 817116 +bm_rtl::method____ErasedReturnType::set_string 856 ns 855 ns 819321 +bm_rtl::method____ErasedTargetType::set_string 860 ns 859 ns 815630 +bm_rtl::method____ErasedTargetAndReturnType::set_string 871 ns 870 ns 803543 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1082 ns 1081 ns 648078 + +bm_call::via_function_ptr__Function::get_string 1079 ns 1078 ns 649415 +bm_call::via_function_ptr____Method::get_string 1080 ns 1079 ns 648859 + +bm_std::function_calls__Function::get_string 1078 ns 1077 ns 649608 +bm_std::function_calls____Method::get_string 1085 ns 1084 ns 646485 + +bm_rtl::function_calls__Function::get_string 1077 ns 1077 ns 650108 +bm_rtl::method_calls______Method::get_string 1080 ns 1079 ns 648442 + +bm_rtl::function__ErasedReturnType::get_string 1115 ns 1114 ns 626958 +bm_rtl::method____ErasedReturnType::get_string 1117 ns 1116 ns 626786 +bm_rtl::method____ErasedTargetType::get_string 1096 ns 1095 ns 638830 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1126 ns 1125 ns 622353 +----------------------------------- +[2025-11-04 11:39:34] >>> Run 2: workload scale = 45 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 45 iterations +============================================= + +2025-11-04T11:39:34+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 0.94, 0.58 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 848 ns 847 ns 822625 + +bm_call::via_function_ptr__Function::set_string 845 ns 844 ns 820487 +bm_call::via_function_ptr____Method::set_string 844 ns 843 ns 829949 + +bm_std::function_calls__Function::set_string 845 ns 844 ns 825232 +bm_std::function_calls____Method::set_string 853 ns 852 ns 821822 + +bm_rtl::function_calls__Function::set_string 845 ns 844 ns 827961 +bm_rtl::method_calls______Method::set_string 845 ns 845 ns 826856 + +bm_rtl::function__ErasedReturnType::set_string 856 ns 855 ns 819788 +bm_rtl::method____ErasedReturnType::set_string 855 ns 854 ns 822908 +bm_rtl::method____ErasedTargetType::set_string 857 ns 857 ns 817574 +bm_rtl::method____ErasedTargetAndReturnType::set_string 868 ns 867 ns 808004 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1083 ns 1082 ns 648003 + +bm_call::via_function_ptr__Function::get_string 1077 ns 1077 ns 649849 +bm_call::via_function_ptr____Method::get_string 1080 ns 1079 ns 649233 + +bm_std::function_calls__Function::get_string 1076 ns 1076 ns 650966 +bm_std::function_calls____Method::get_string 1088 ns 1087 ns 643800 + +bm_rtl::function_calls__Function::get_string 1078 ns 1078 ns 646730 +bm_rtl::method_calls______Method::get_string 1078 ns 1078 ns 649617 + +bm_rtl::function__ErasedReturnType::get_string 1112 ns 1111 ns 629505 +bm_rtl::method____ErasedReturnType::get_string 1116 ns 1116 ns 626620 +bm_rtl::method____ErasedTargetType::get_string 1094 ns 1093 ns 640864 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1121 ns 1120 ns 619886 +----------------------------------- +[2025-11-04 11:39:52] >>> Run 3: workload scale = 45 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 45 iterations +============================================= + +2025-11-04T11:39:52+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.00, 0.94, 0.59 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 841 ns 841 ns 828006 + +bm_call::via_function_ptr__Function::set_string 846 ns 845 ns 827058 +bm_call::via_function_ptr____Method::set_string 844 ns 843 ns 830739 + +bm_std::function_calls__Function::set_string 844 ns 843 ns 826509 +bm_std::function_calls____Method::set_string 849 ns 848 ns 825604 + +bm_rtl::function_calls__Function::set_string 846 ns 846 ns 828447 +bm_rtl::method_calls______Method::set_string 845 ns 844 ns 829668 + +bm_rtl::function__ErasedReturnType::set_string 855 ns 854 ns 821153 +bm_rtl::method____ErasedReturnType::set_string 860 ns 859 ns 813919 +bm_rtl::method____ErasedTargetType::set_string 855 ns 854 ns 818020 +bm_rtl::method____ErasedTargetAndReturnType::set_string 869 ns 869 ns 807824 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1074 ns 1073 ns 652774 + +bm_call::via_function_ptr__Function::get_string 1071 ns 1070 ns 653625 +bm_call::via_function_ptr____Method::get_string 1072 ns 1071 ns 653933 + +bm_std::function_calls__Function::get_string 1072 ns 1071 ns 653516 +bm_std::function_calls____Method::get_string 1079 ns 1079 ns 648755 + +bm_rtl::function_calls__Function::get_string 1071 ns 1071 ns 654398 +bm_rtl::method_calls______Method::get_string 1072 ns 1072 ns 653285 + +bm_rtl::function__ErasedReturnType::get_string 1108 ns 1108 ns 631753 +bm_rtl::method____ErasedReturnType::get_string 1111 ns 1111 ns 630268 +bm_rtl::method____ErasedTargetType::get_string 1085 ns 1084 ns 645525 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1122 ns 1121 ns 624251 +----------------------------------- +[2025-11-04 11:40:09] >>> Run 1: workload scale = 50 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 50 iterations +============================================= + +2025-11-04T11:40:09+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.06, 0.96, 0.60 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 909 ns 909 ns 767477 + +bm_call::via_function_ptr__Function::set_string 912 ns 911 ns 767505 +bm_call::via_function_ptr____Method::set_string 909 ns 909 ns 770254 + +bm_std::function_calls__Function::set_string 911 ns 910 ns 771378 +bm_std::function_calls____Method::set_string 912 ns 912 ns 768127 + +bm_rtl::function_calls__Function::set_string 911 ns 911 ns 768533 +bm_rtl::method_calls______Method::set_string 911 ns 911 ns 768158 + +bm_rtl::function__ErasedReturnType::set_string 919 ns 919 ns 760767 +bm_rtl::method____ErasedReturnType::set_string 926 ns 926 ns 755851 +bm_rtl::method____ErasedTargetType::set_string 933 ns 932 ns 751905 +bm_rtl::method____ErasedTargetAndReturnType::set_string 931 ns 930 ns 751605 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1174 ns 1174 ns 596533 + +bm_call::via_function_ptr__Function::get_string 1175 ns 1174 ns 596482 +bm_call::via_function_ptr____Method::get_string 1175 ns 1175 ns 595587 + +bm_std::function_calls__Function::get_string 1174 ns 1173 ns 596838 +bm_std::function_calls____Method::get_string 1178 ns 1177 ns 594976 + +bm_rtl::function_calls__Function::get_string 1174 ns 1173 ns 596710 +bm_rtl::method_calls______Method::get_string 1176 ns 1175 ns 596243 + +bm_rtl::function__ErasedReturnType::get_string 1214 ns 1213 ns 577055 +bm_rtl::method____ErasedReturnType::get_string 1213 ns 1213 ns 577546 +bm_rtl::method____ErasedTargetType::get_string 1198 ns 1198 ns 584466 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1219 ns 1218 ns 574204 +----------------------------------- +[2025-11-04 11:40:27] >>> Run 2: workload scale = 50 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 50 iterations +============================================= + +2025-11-04T11:40:27+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.05, 0.97, 0.61 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 943 ns 942 ns 737843 + +bm_call::via_function_ptr__Function::set_string 944 ns 943 ns 742177 +bm_call::via_function_ptr____Method::set_string 944 ns 944 ns 742264 + +bm_std::function_calls__Function::set_string 944 ns 943 ns 743093 +bm_std::function_calls____Method::set_string 947 ns 946 ns 738334 + +bm_rtl::function_calls__Function::set_string 944 ns 944 ns 741385 +bm_rtl::method_calls______Method::set_string 945 ns 944 ns 741519 + +bm_rtl::function__ErasedReturnType::set_string 957 ns 956 ns 730993 +bm_rtl::method____ErasedReturnType::set_string 961 ns 961 ns 729195 +bm_rtl::method____ErasedTargetType::set_string 959 ns 958 ns 730421 +bm_rtl::method____ErasedTargetAndReturnType::set_string 967 ns 967 ns 723365 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1259 ns 1259 ns 556770 + +bm_call::via_function_ptr__Function::get_string 1261 ns 1260 ns 554829 +bm_call::via_function_ptr____Method::get_string 1261 ns 1261 ns 555062 + +bm_std::function_calls__Function::get_string 1261 ns 1260 ns 554486 +bm_std::function_calls____Method::get_string 1266 ns 1266 ns 553304 + +bm_rtl::function_calls__Function::get_string 1261 ns 1260 ns 555273 +bm_rtl::method_calls______Method::get_string 1262 ns 1262 ns 554575 + +bm_rtl::function__ErasedReturnType::get_string 1292 ns 1292 ns 541838 +bm_rtl::method____ErasedReturnType::get_string 1294 ns 1293 ns 541593 +bm_rtl::method____ErasedTargetType::get_string 1279 ns 1279 ns 546731 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1307 ns 1306 ns 536321 +----------------------------------- +[2025-11-04 11:40:46] >>> Run 3: workload scale = 50 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 50 iterations +============================================= + +2025-11-04T11:40:46+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.03, 0.97, 0.62 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 913 ns 913 ns 765510 + +bm_call::via_function_ptr__Function::set_string 910 ns 909 ns 771256 +bm_call::via_function_ptr____Method::set_string 909 ns 908 ns 771309 + +bm_std::function_calls__Function::set_string 908 ns 907 ns 770894 +bm_std::function_calls____Method::set_string 912 ns 912 ns 768112 + +bm_rtl::function_calls__Function::set_string 907 ns 907 ns 770584 +bm_rtl::method_calls______Method::set_string 908 ns 908 ns 771993 + +bm_rtl::function__ErasedReturnType::set_string 921 ns 921 ns 760196 +bm_rtl::method____ErasedReturnType::set_string 924 ns 923 ns 756860 +bm_rtl::method____ErasedTargetType::set_string 926 ns 926 ns 757342 +bm_rtl::method____ErasedTargetAndReturnType::set_string 929 ns 929 ns 754776 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1174 ns 1173 ns 595250 + +bm_call::via_function_ptr__Function::get_string 1172 ns 1172 ns 597161 +bm_call::via_function_ptr____Method::get_string 1173 ns 1172 ns 597285 + +bm_std::function_calls__Function::get_string 1173 ns 1172 ns 597217 +bm_std::function_calls____Method::get_string 1177 ns 1177 ns 595388 + +bm_rtl::function_calls__Function::get_string 1172 ns 1171 ns 597813 +bm_rtl::method_calls______Method::get_string 1173 ns 1173 ns 596603 + +bm_rtl::function__ErasedReturnType::get_string 1206 ns 1206 ns 580285 +bm_rtl::method____ErasedReturnType::get_string 1211 ns 1210 ns 578485 +bm_rtl::method____ErasedTargetType::get_string 1190 ns 1189 ns 588583 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1222 ns 1221 ns 573429 +----------------------------------- +[2025-11-04 11:41:04] >>> Run 1: workload scale = 58 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 58 iterations +============================================= + +2025-11-04T11:41:04+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.02, 0.97, 0.63 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1032 ns 1031 ns 676070 + +bm_call::via_function_ptr__Function::set_string 1032 ns 1031 ns 678824 +bm_call::via_function_ptr____Method::set_string 1032 ns 1031 ns 678016 + +bm_std::function_calls__Function::set_string 1031 ns 1031 ns 677827 +bm_std::function_calls____Method::set_string 1036 ns 1036 ns 674869 + +bm_rtl::function_calls__Function::set_string 1030 ns 1029 ns 679752 +bm_rtl::method_calls______Method::set_string 1032 ns 1031 ns 678902 + +bm_rtl::function__ErasedReturnType::set_string 1042 ns 1042 ns 671992 +bm_rtl::method____ErasedReturnType::set_string 1044 ns 1044 ns 669776 +bm_rtl::method____ErasedTargetType::set_string 1048 ns 1048 ns 669636 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1057 ns 1057 ns 662078 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1320 ns 1319 ns 530013 + +bm_call::via_function_ptr__Function::get_string 1320 ns 1319 ns 530104 +bm_call::via_function_ptr____Method::get_string 1322 ns 1321 ns 529144 + +bm_std::function_calls__Function::get_string 1321 ns 1320 ns 530134 +bm_std::function_calls____Method::get_string 1328 ns 1327 ns 526957 + +bm_rtl::function_calls__Function::get_string 1320 ns 1319 ns 530249 +bm_rtl::method_calls______Method::get_string 1323 ns 1322 ns 529609 + +bm_rtl::function__ErasedReturnType::get_string 1362 ns 1361 ns 514888 +bm_rtl::method____ErasedReturnType::get_string 1368 ns 1367 ns 512162 +bm_rtl::method____ErasedTargetType::get_string 1334 ns 1334 ns 524950 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1372 ns 1371 ns 510495 +----------------------------------- +[2025-11-04 11:41:22] >>> Run 2: workload scale = 58 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 58 iterations +============================================= + +2025-11-04T11:41:22+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 820.226 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.02, 0.97, 0.64 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1031 ns 1031 ns 675121 + +bm_call::via_function_ptr__Function::set_string 1031 ns 1030 ns 679015 +bm_call::via_function_ptr____Method::set_string 1032 ns 1031 ns 679476 + +bm_std::function_calls__Function::set_string 1031 ns 1031 ns 677910 +bm_std::function_calls____Method::set_string 1041 ns 1041 ns 670513 + +bm_rtl::function_calls__Function::set_string 1032 ns 1031 ns 680773 +bm_rtl::method_calls______Method::set_string 1032 ns 1032 ns 679489 + +bm_rtl::function__ErasedReturnType::set_string 1042 ns 1041 ns 671509 +bm_rtl::method____ErasedReturnType::set_string 1046 ns 1045 ns 668786 +bm_rtl::method____ErasedTargetType::set_string 1051 ns 1050 ns 668456 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1051 ns 1051 ns 665655 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1321 ns 1320 ns 529589 + +bm_call::via_function_ptr__Function::get_string 1319 ns 1319 ns 527334 +bm_call::via_function_ptr____Method::get_string 1321 ns 1320 ns 530323 + +bm_std::function_calls__Function::get_string 1321 ns 1320 ns 530845 +bm_std::function_calls____Method::get_string 1330 ns 1329 ns 526538 + +bm_rtl::function_calls__Function::get_string 1320 ns 1320 ns 531222 +bm_rtl::method_calls______Method::get_string 1321 ns 1320 ns 530152 + +bm_rtl::function__ErasedReturnType::get_string 1361 ns 1361 ns 514252 +bm_rtl::method____ErasedReturnType::get_string 1362 ns 1362 ns 510922 +bm_rtl::method____ErasedTargetType::get_string 1338 ns 1337 ns 523350 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1371 ns 1370 ns 512355 +----------------------------------- +[2025-11-04 11:41:40] >>> Run 3: workload scale = 58 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 58 iterations +============================================= + +2025-11-04T11:41:40+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.01, 0.98, 0.64 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1017 ns 1027 ns 679622 + +bm_call::via_function_ptr__Function::set_string 1015 ns 1029 ns 680787 +bm_call::via_function_ptr____Method::set_string 1016 ns 1029 ns 679486 + +bm_std::function_calls__Function::set_string 1018 ns 1030 ns 680557 +bm_std::function_calls____Method::set_string 1030 ns 1040 ns 672817 + +bm_rtl::function_calls__Function::set_string 1019 ns 1028 ns 680440 +bm_rtl::method_calls______Method::set_string 1021 ns 1030 ns 679426 + +bm_rtl::function__ErasedReturnType::set_string 1033 ns 1041 ns 669612 +bm_rtl::method____ErasedReturnType::set_string 1033 ns 1041 ns 673638 +bm_rtl::method____ErasedTargetType::set_string 1044 ns 1050 ns 668898 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1043 ns 1049 ns 667070 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1315 ns 1321 ns 530349 + +bm_call::via_function_ptr__Function::get_string 1313 ns 1319 ns 530447 +bm_call::via_function_ptr____Method::get_string 1314 ns 1320 ns 529779 + +bm_std::function_calls__Function::get_string 1317 ns 1322 ns 530934 +bm_std::function_calls____Method::get_string 1321 ns 1326 ns 527723 + +bm_rtl::function_calls__Function::get_string 1317 ns 1321 ns 530957 +bm_rtl::method_calls______Method::get_string 1316 ns 1320 ns 530817 + +bm_rtl::function__ErasedReturnType::get_string 1354 ns 1357 ns 515832 +bm_rtl::method____ErasedReturnType::get_string 1358 ns 1361 ns 508856 +bm_rtl::method____ErasedTargetType::get_string 1336 ns 1339 ns 522359 +bm_rtl::method____ErasedTargetAndReturnType::get_string 1363 ns 1366 ns 511858 +----------------------------------- +[2025-11-04 11:41:58] >>> Run 1: workload scale = 66 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 66 iterations +============================================= + +2025-11-04T11:41:58+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.08, 0.99, 0.66 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1657 ns 1660 ns 421772 + +bm_call::via_function_ptr__Function::set_string 1659 ns 1661 ns 421261 +bm_call::via_function_ptr____Method::set_string 1657 ns 1659 ns 421660 + +bm_std::function_calls__Function::set_string 1659 ns 1661 ns 421457 +bm_std::function_calls____Method::set_string 1664 ns 1666 ns 417619 + +bm_rtl::function_calls__Function::set_string 1655 ns 1657 ns 421767 +bm_rtl::method_calls______Method::set_string 1660 ns 1662 ns 421804 + +bm_rtl::function__ErasedReturnType::set_string 1653 ns 1655 ns 418490 +bm_rtl::method____ErasedReturnType::set_string 1662 ns 1663 ns 424133 +bm_rtl::method____ErasedTargetType::set_string 1675 ns 1677 ns 417375 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1698 ns 1699 ns 412042 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2033 ns 2035 ns 343824 + +bm_call::via_function_ptr__Function::get_string 2029 ns 2030 ns 344946 +bm_call::via_function_ptr____Method::get_string 2029 ns 2030 ns 344269 + +bm_std::function_calls__Function::get_string 2029 ns 2030 ns 344471 +bm_std::function_calls____Method::get_string 2037 ns 2038 ns 344001 + +bm_rtl::function_calls__Function::get_string 2032 ns 2030 ns 344558 +bm_rtl::method_calls______Method::get_string 2034 ns 2032 ns 345067 + +bm_rtl::function__ErasedReturnType::get_string 2076 ns 2075 ns 337071 +bm_rtl::method____ErasedReturnType::get_string 2082 ns 2080 ns 336215 +bm_rtl::method____ErasedTargetType::get_string 2049 ns 2048 ns 342138 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2085 ns 2083 ns 336181 +----------------------------------- +[2025-11-04 11:42:18] >>> Run 2: workload scale = 66 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 66 iterations +============================================= + +2025-11-04T11:42:18+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.05, 1.00, 0.67 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1668 ns 1666 ns 420591 + +bm_call::via_function_ptr__Function::set_string 1666 ns 1665 ns 420519 +bm_call::via_function_ptr____Method::set_string 1665 ns 1664 ns 420393 + +bm_std::function_calls__Function::set_string 1666 ns 1665 ns 420597 +bm_std::function_calls____Method::set_string 1670 ns 1669 ns 418433 + +bm_rtl::function_calls__Function::set_string 1661 ns 1660 ns 421384 +bm_rtl::method_calls______Method::set_string 1664 ns 1663 ns 421078 + +bm_rtl::function__ErasedReturnType::set_string 1674 ns 1674 ns 418103 +bm_rtl::method____ErasedReturnType::set_string 1676 ns 1676 ns 417778 +bm_rtl::method____ErasedTargetType::set_string 1681 ns 1680 ns 417245 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1684 ns 1683 ns 415930 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 1986 ns 1985 ns 352254 + +bm_call::via_function_ptr__Function::get_string 1987 ns 1986 ns 352702 +bm_call::via_function_ptr____Method::get_string 1988 ns 1988 ns 352071 + +bm_std::function_calls__Function::get_string 1987 ns 1986 ns 352640 +bm_std::function_calls____Method::get_string 1993 ns 1993 ns 350926 + +bm_rtl::function_calls__Function::get_string 1986 ns 1986 ns 352094 +bm_rtl::method_calls______Method::get_string 1989 ns 1989 ns 351886 + +bm_rtl::function__ErasedReturnType::get_string 2027 ns 2027 ns 345297 +bm_rtl::method____ErasedReturnType::get_string 2029 ns 2029 ns 345232 +bm_rtl::method____ErasedTargetType::get_string 2004 ns 2004 ns 349685 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2034 ns 2034 ns 344459 +----------------------------------- +[2025-11-04 11:42:38] >>> Run 3: workload scale = 66 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 66 iterations +============================================= + +2025-11-04T11:42:38+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.04, 1.00, 0.67 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1656 ns 1656 ns 419723 + +bm_call::via_function_ptr__Function::set_string 1655 ns 1655 ns 422991 +bm_call::via_function_ptr____Method::set_string 1657 ns 1657 ns 422611 + +bm_std::function_calls__Function::set_string 1656 ns 1656 ns 422654 +bm_std::function_calls____Method::set_string 1671 ns 1671 ns 419437 + +bm_rtl::function_calls__Function::set_string 1653 ns 1653 ns 423328 +bm_rtl::method_calls______Method::set_string 1658 ns 1658 ns 422855 + +bm_rtl::function__ErasedReturnType::set_string 1671 ns 1671 ns 418940 +bm_rtl::method____ErasedReturnType::set_string 1672 ns 1672 ns 418670 +bm_rtl::method____ErasedTargetType::set_string 1678 ns 1678 ns 415373 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1679 ns 1679 ns 416931 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2035 ns 2036 ns 344330 + +bm_call::via_function_ptr__Function::get_string 2031 ns 2032 ns 344346 +bm_call::via_function_ptr____Method::get_string 2034 ns 2035 ns 344556 + +bm_std::function_calls__Function::get_string 2033 ns 2033 ns 344441 +bm_std::function_calls____Method::get_string 2040 ns 2041 ns 343498 + +bm_rtl::function_calls__Function::get_string 2032 ns 2032 ns 344410 +bm_rtl::method_calls______Method::get_string 2035 ns 2035 ns 344515 + +bm_rtl::function__ErasedReturnType::get_string 2076 ns 2077 ns 336831 +bm_rtl::method____ErasedReturnType::get_string 2077 ns 2077 ns 336922 +bm_rtl::method____ErasedTargetType::get_string 2049 ns 2049 ns 340087 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2083 ns 2084 ns 336074 +----------------------------------- +[2025-11-04 11:42:58] >>> Run 1: workload scale = 74 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 74 iterations +============================================= + +2025-11-04T11:42:58+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.03, 1.00, 0.68 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1702 ns 1702 ns 410993 + +bm_call::via_function_ptr__Function::set_string 1700 ns 1701 ns 411578 +bm_call::via_function_ptr____Method::set_string 1701 ns 1701 ns 411305 + +bm_std::function_calls__Function::set_string 1703 ns 1704 ns 410550 +bm_std::function_calls____Method::set_string 1706 ns 1706 ns 410063 + +bm_rtl::function_calls__Function::set_string 1699 ns 1699 ns 412192 +bm_rtl::method_calls______Method::set_string 1700 ns 1701 ns 412000 + +bm_rtl::function__ErasedReturnType::set_string 1739 ns 1739 ns 401572 +bm_rtl::method____ErasedReturnType::set_string 1724 ns 1725 ns 405479 +bm_rtl::method____ErasedTargetType::set_string 1726 ns 1727 ns 405687 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1775 ns 1776 ns 393707 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2054 ns 2054 ns 340080 + +bm_call::via_function_ptr__Function::get_string 2054 ns 2055 ns 340747 +bm_call::via_function_ptr____Method::get_string 2056 ns 2056 ns 340564 + +bm_std::function_calls__Function::get_string 2054 ns 2055 ns 340353 +bm_std::function_calls____Method::get_string 2064 ns 2065 ns 339177 + +bm_rtl::function_calls__Function::get_string 2059 ns 2060 ns 340492 +bm_rtl::method_calls______Method::get_string 2056 ns 2057 ns 339582 + +bm_rtl::function__ErasedReturnType::get_string 2106 ns 2106 ns 331861 +bm_rtl::method____ErasedReturnType::get_string 2146 ns 2147 ns 326249 +bm_rtl::method____ErasedTargetType::get_string 2091 ns 2092 ns 334710 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2116 ns 2116 ns 330808 +----------------------------------- +[2025-11-04 11:43:18] >>> Run 2: workload scale = 74 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 74 iterations +============================================= + +2025-11-04T11:43:18+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.02, 1.00, 0.69 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1705 ns 1706 ns 410050 + +bm_call::via_function_ptr__Function::set_string 1703 ns 1703 ns 411193 +bm_call::via_function_ptr____Method::set_string 1704 ns 1704 ns 410529 + +bm_std::function_calls__Function::set_string 1703 ns 1703 ns 411017 +bm_std::function_calls____Method::set_string 1713 ns 1713 ns 408256 + +bm_rtl::function_calls__Function::set_string 1702 ns 1702 ns 410861 +bm_rtl::method_calls______Method::set_string 1702 ns 1703 ns 411267 + +bm_rtl::function__ErasedReturnType::set_string 1758 ns 1759 ns 398120 +bm_rtl::method____ErasedReturnType::set_string 1746 ns 1747 ns 400302 +bm_rtl::method____ErasedTargetType::set_string 1738 ns 1739 ns 403136 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1717 ns 1718 ns 406824 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2062 ns 2062 ns 339419 + +bm_call::via_function_ptr__Function::get_string 2062 ns 2063 ns 339231 +bm_call::via_function_ptr____Method::get_string 2064 ns 2065 ns 339106 + +bm_std::function_calls__Function::get_string 2062 ns 2063 ns 339570 +bm_std::function_calls____Method::get_string 2070 ns 2070 ns 338163 + +bm_rtl::function_calls__Function::get_string 2064 ns 2065 ns 338796 +bm_rtl::method_calls______Method::get_string 2065 ns 2066 ns 339087 + +bm_rtl::function__ErasedReturnType::get_string 2105 ns 2106 ns 332120 +bm_rtl::method____ErasedReturnType::get_string 2100 ns 2100 ns 333314 +bm_rtl::method____ErasedTargetType::get_string 2095 ns 2096 ns 333978 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2105 ns 2106 ns 332620 +----------------------------------- +[2025-11-04 11:43:38] >>> Run 3: workload scale = 74 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 74 iterations +============================================= + +2025-11-04T11:43:38+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.08, 1.02, 0.70 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1725 ns 1726 ns 406312 + +bm_call::via_function_ptr__Function::set_string 1726 ns 1726 ns 405636 +bm_call::via_function_ptr____Method::set_string 1727 ns 1727 ns 405754 + +bm_std::function_calls__Function::set_string 1724 ns 1725 ns 405818 +bm_std::function_calls____Method::set_string 1731 ns 1731 ns 404376 + +bm_rtl::function_calls__Function::set_string 1726 ns 1726 ns 402702 +bm_rtl::method_calls______Method::set_string 1725 ns 1725 ns 406029 + +bm_rtl::function__ErasedReturnType::set_string 1734 ns 1734 ns 403830 +bm_rtl::method____ErasedReturnType::set_string 1736 ns 1736 ns 403200 +bm_rtl::method____ErasedTargetType::set_string 1741 ns 1742 ns 402231 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1741 ns 1742 ns 401846 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2091 ns 2092 ns 334903 + +bm_call::via_function_ptr__Function::get_string 2087 ns 2087 ns 335367 +bm_call::via_function_ptr____Method::get_string 2090 ns 2090 ns 335217 + +bm_std::function_calls__Function::get_string 2087 ns 2087 ns 335223 +bm_std::function_calls____Method::get_string 2093 ns 2094 ns 334231 + +bm_rtl::function_calls__Function::get_string 2087 ns 2088 ns 333794 +bm_rtl::method_calls______Method::get_string 2089 ns 2089 ns 335209 + +bm_rtl::function__ErasedReturnType::get_string 2130 ns 2130 ns 328921 +bm_rtl::method____ErasedReturnType::get_string 2131 ns 2131 ns 328695 +bm_rtl::method____ErasedTargetType::get_string 2109 ns 2110 ns 332174 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2139 ns 2140 ns 327151 +----------------------------------- +[2025-11-04 11:43:58] >>> Run 1: workload scale = 82 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 82 iterations +============================================= + +2025-11-04T11:43:58+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.06, 1.01, 0.71 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1797 ns 1797 ns 389525 + +bm_call::via_function_ptr__Function::set_string 1798 ns 1798 ns 389536 +bm_call::via_function_ptr____Method::set_string 1798 ns 1798 ns 389365 + +bm_std::function_calls__Function::set_string 1800 ns 1801 ns 389607 +bm_std::function_calls____Method::set_string 1829 ns 1830 ns 386984 + +bm_rtl::function_calls__Function::set_string 1810 ns 1810 ns 380113 +bm_rtl::method_calls______Method::set_string 1798 ns 1799 ns 389381 + +bm_rtl::function__ErasedReturnType::set_string 1802 ns 1803 ns 388635 +bm_rtl::method____ErasedReturnType::set_string 1803 ns 1803 ns 388548 +bm_rtl::method____ErasedTargetType::set_string 1811 ns 1812 ns 386464 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1810 ns 1811 ns 386941 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2284 ns 2285 ns 306552 + +bm_call::via_function_ptr__Function::get_string 2283 ns 2284 ns 306654 +bm_call::via_function_ptr____Method::get_string 2286 ns 2286 ns 306173 + +bm_std::function_calls__Function::get_string 2283 ns 2284 ns 306482 +bm_std::function_calls____Method::get_string 2290 ns 2290 ns 305618 + +bm_rtl::function_calls__Function::get_string 2283 ns 2284 ns 306531 +bm_rtl::method_calls______Method::get_string 2285 ns 2285 ns 306323 + +bm_rtl::function__ErasedReturnType::get_string 2326 ns 2327 ns 300755 +bm_rtl::method____ErasedReturnType::get_string 2325 ns 2325 ns 300885 +bm_rtl::method____ErasedTargetType::get_string 2310 ns 2311 ns 302696 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2330 ns 2330 ns 300284 +----------------------------------- +[2025-11-04 11:44:19] >>> Run 2: workload scale = 82 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 82 iterations +============================================= + +2025-11-04T11:44:19+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 851.313 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.10, 1.03, 0.72 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1778 ns 1778 ns 393555 + +bm_call::via_function_ptr__Function::set_string 1783 ns 1783 ns 393270 +bm_call::via_function_ptr____Method::set_string 1785 ns 1785 ns 392516 + +bm_std::function_calls__Function::set_string 1782 ns 1783 ns 393411 +bm_std::function_calls____Method::set_string 1789 ns 1789 ns 391871 + +bm_rtl::function_calls__Function::set_string 1780 ns 1781 ns 392505 +bm_rtl::method_calls______Method::set_string 1778 ns 1778 ns 393604 + +bm_rtl::function__ErasedReturnType::set_string 1778 ns 1779 ns 391999 +bm_rtl::method____ErasedReturnType::set_string 1782 ns 1783 ns 392539 +bm_rtl::method____ErasedTargetType::set_string 1794 ns 1794 ns 389821 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1786 ns 1787 ns 391779 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2181 ns 2181 ns 321380 + +bm_call::via_function_ptr__Function::get_string 2175 ns 2176 ns 321625 +bm_call::via_function_ptr____Method::get_string 2178 ns 2179 ns 321527 + +bm_std::function_calls__Function::get_string 2175 ns 2176 ns 321528 +bm_std::function_calls____Method::get_string 2186 ns 2186 ns 320422 + +bm_rtl::function_calls__Function::get_string 2173 ns 2174 ns 322110 +bm_rtl::method_calls______Method::get_string 2180 ns 2180 ns 321745 + +bm_rtl::function__ErasedReturnType::get_string 2217 ns 2218 ns 315599 +bm_rtl::method____ErasedReturnType::get_string 2219 ns 2220 ns 315241 +bm_rtl::method____ErasedTargetType::get_string 2195 ns 2196 ns 317502 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2221 ns 2222 ns 315139 +----------------------------------- +[2025-11-04 11:44:39] >>> Run 3: workload scale = 82 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 82 iterations +============================================= + +2025-11-04T11:44:39+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 4073.78 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.07, 1.03, 0.73 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1789 ns 1789 ns 391681 + +bm_call::via_function_ptr__Function::set_string 1790 ns 1791 ns 391507 +bm_call::via_function_ptr____Method::set_string 1791 ns 1792 ns 390930 + +bm_std::function_calls__Function::set_string 1787 ns 1788 ns 391890 +bm_std::function_calls____Method::set_string 1794 ns 1794 ns 390805 + +bm_rtl::function_calls__Function::set_string 1786 ns 1787 ns 392220 +bm_rtl::method_calls______Method::set_string 1790 ns 1790 ns 391457 + +bm_rtl::function__ErasedReturnType::set_string 1789 ns 1789 ns 391299 +bm_rtl::method____ErasedReturnType::set_string 1790 ns 1791 ns 391105 +bm_rtl::method____ErasedTargetType::set_string 1797 ns 1798 ns 389126 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1798 ns 1799 ns 388968 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2281 ns 2282 ns 307129 + +bm_call::via_function_ptr__Function::get_string 2277 ns 2278 ns 307178 +bm_call::via_function_ptr____Method::get_string 2282 ns 2283 ns 307132 + +bm_std::function_calls__Function::get_string 2278 ns 2279 ns 307271 +bm_std::function_calls____Method::get_string 2289 ns 2290 ns 306018 + +bm_rtl::function_calls__Function::get_string 2276 ns 2277 ns 307466 +bm_rtl::method_calls______Method::get_string 2283 ns 2283 ns 306991 + +bm_rtl::function__ErasedReturnType::get_string 2316 ns 2316 ns 302121 +bm_rtl::method____ErasedReturnType::get_string 2317 ns 2318 ns 302362 +bm_rtl::method____ErasedTargetType::get_string 2302 ns 2303 ns 304074 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2325 ns 2325 ns 301350 +----------------------------------- +[2025-11-04 11:44:59] >>> Run 1: workload scale = 90 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 90 iterations +============================================= + +2025-11-04T11:44:59+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.05, 1.02, 0.74 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1855 ns 1856 ns 377098 + +bm_call::via_function_ptr__Function::set_string 1855 ns 1855 ns 378267 +bm_call::via_function_ptr____Method::set_string 1853 ns 1853 ns 377675 + +bm_std::function_calls__Function::set_string 1853 ns 1854 ns 378218 +bm_std::function_calls____Method::set_string 1862 ns 1862 ns 376248 + +bm_rtl::function_calls__Function::set_string 1850 ns 1850 ns 378137 +bm_rtl::method_calls______Method::set_string 1855 ns 1856 ns 377582 + +bm_rtl::function__ErasedReturnType::set_string 1862 ns 1863 ns 375415 +bm_rtl::method____ErasedReturnType::set_string 1864 ns 1865 ns 376111 +bm_rtl::method____ErasedTargetType::set_string 1869 ns 1870 ns 374624 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1870 ns 1870 ns 373729 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2285 ns 2285 ns 305947 + +bm_call::via_function_ptr__Function::get_string 2287 ns 2288 ns 305982 +bm_call::via_function_ptr____Method::get_string 2289 ns 2290 ns 305610 + +bm_std::function_calls__Function::get_string 2287 ns 2288 ns 305896 +bm_std::function_calls____Method::get_string 2290 ns 2291 ns 305644 + +bm_rtl::function_calls__Function::get_string 2287 ns 2288 ns 306110 +bm_rtl::method_calls______Method::get_string 2289 ns 2289 ns 305683 + +bm_rtl::function__ErasedReturnType::get_string 2321 ns 2322 ns 301437 +bm_rtl::method____ErasedReturnType::get_string 2323 ns 2323 ns 301190 +bm_rtl::method____ErasedTargetType::get_string 2295 ns 2295 ns 304947 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2331 ns 2332 ns 300136 +----------------------------------- +[2025-11-04 11:45:20] >>> Run 2: workload scale = 90 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 90 iterations +============================================= + +2025-11-04T11:45:20+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.04, 1.02, 0.74 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1870 ns 1871 ns 373902 + +bm_call::via_function_ptr__Function::set_string 1866 ns 1866 ns 375733 +bm_call::via_function_ptr____Method::set_string 1860 ns 1860 ns 376397 + +bm_std::function_calls__Function::set_string 1859 ns 1860 ns 376365 +bm_std::function_calls____Method::set_string 1862 ns 1863 ns 373798 + +bm_rtl::function_calls__Function::set_string 1857 ns 1858 ns 376991 +bm_rtl::method_calls______Method::set_string 1862 ns 1863 ns 376328 + +bm_rtl::function__ErasedReturnType::set_string 1865 ns 1865 ns 375497 +bm_rtl::method____ErasedReturnType::set_string 1868 ns 1868 ns 375141 +bm_rtl::method____ErasedTargetType::set_string 1872 ns 1873 ns 373961 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1876 ns 1876 ns 373051 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2317 ns 2317 ns 301971 + +bm_call::via_function_ptr__Function::get_string 2312 ns 2312 ns 302404 +bm_call::via_function_ptr____Method::get_string 2313 ns 2314 ns 302312 + +bm_std::function_calls__Function::get_string 2312 ns 2313 ns 302678 +bm_std::function_calls____Method::get_string 2320 ns 2320 ns 301614 + +bm_rtl::function_calls__Function::get_string 2313 ns 2314 ns 302455 +bm_rtl::method_calls______Method::get_string 2314 ns 2315 ns 302291 + +bm_rtl::function__ErasedReturnType::get_string 2350 ns 2351 ns 297755 +bm_rtl::method____ErasedReturnType::get_string 2354 ns 2354 ns 297340 +bm_rtl::method____ErasedTargetType::get_string 2333 ns 2334 ns 300017 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2366 ns 2366 ns 295941 +----------------------------------- +[2025-11-04 11:45:40] >>> Run 3: workload scale = 90 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 90 iterations +============================================= + +2025-11-04T11:45:40+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 3231.2 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.09, 1.04, 0.75 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1868 ns 1869 ns 374396 + +bm_call::via_function_ptr__Function::set_string 1867 ns 1867 ns 374797 +bm_call::via_function_ptr____Method::set_string 1868 ns 1869 ns 374400 + +bm_std::function_calls__Function::set_string 1867 ns 1868 ns 375065 +bm_std::function_calls____Method::set_string 1871 ns 1872 ns 374292 + +bm_rtl::function_calls__Function::set_string 1867 ns 1867 ns 374894 +bm_rtl::method_calls______Method::set_string 1869 ns 1869 ns 374490 + +bm_rtl::function__ErasedReturnType::set_string 1871 ns 1872 ns 373958 +bm_rtl::method____ErasedReturnType::set_string 1875 ns 1875 ns 373262 +bm_rtl::method____ErasedTargetType::set_string 1883 ns 1883 ns 371719 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1883 ns 1884 ns 371947 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2410 ns 2410 ns 290228 + +bm_call::via_function_ptr__Function::get_string 2410 ns 2411 ns 290367 +bm_call::via_function_ptr____Method::get_string 2412 ns 2413 ns 290266 + +bm_std::function_calls__Function::get_string 2408 ns 2409 ns 290412 +bm_std::function_calls____Method::get_string 2417 ns 2418 ns 289516 + +bm_rtl::function_calls__Function::get_string 2410 ns 2411 ns 290432 +bm_rtl::method_calls______Method::get_string 2411 ns 2411 ns 290130 + +bm_rtl::function__ErasedReturnType::get_string 2448 ns 2449 ns 285773 +bm_rtl::method____ErasedReturnType::get_string 2453 ns 2454 ns 285286 +bm_rtl::method____ErasedTargetType::get_string 2433 ns 2434 ns 287844 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2458 ns 2458 ns 284818 +----------------------------------- +[2025-11-04 11:46:01] >>> Run 1: workload scale = 100 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 100 iterations +============================================= + +2025-11-04T11:46:01+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 2637.51 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.06, 1.03, 0.76 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1962 ns 1962 ns 356628 + +bm_call::via_function_ptr__Function::set_string 1959 ns 1960 ns 357267 +bm_call::via_function_ptr____Method::set_string 1958 ns 1959 ns 357354 + +bm_std::function_calls__Function::set_string 1958 ns 1959 ns 357026 +bm_std::function_calls____Method::set_string 1966 ns 1966 ns 356465 + +bm_rtl::function_calls__Function::set_string 1959 ns 1959 ns 357324 +bm_rtl::method_calls______Method::set_string 1959 ns 1960 ns 357320 + +bm_rtl::function__ErasedReturnType::set_string 1971 ns 1971 ns 354968 +bm_rtl::method____ErasedReturnType::set_string 1967 ns 1968 ns 355173 +bm_rtl::method____ErasedTargetType::set_string 1976 ns 1977 ns 354265 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1977 ns 1978 ns 353660 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2488 ns 2488 ns 281199 + +bm_call::via_function_ptr__Function::get_string 2486 ns 2487 ns 281683 +bm_call::via_function_ptr____Method::get_string 2490 ns 2491 ns 280922 + +bm_std::function_calls__Function::get_string 2492 ns 2492 ns 280970 +bm_std::function_calls____Method::get_string 2494 ns 2495 ns 280222 + +bm_rtl::function_calls__Function::get_string 2485 ns 2486 ns 281630 +bm_rtl::method_calls______Method::get_string 2488 ns 2489 ns 281276 + +bm_rtl::function__ErasedReturnType::get_string 2523 ns 2524 ns 277389 +bm_rtl::method____ErasedReturnType::get_string 2527 ns 2528 ns 276820 +bm_rtl::method____ErasedTargetType::get_string 2504 ns 2504 ns 279332 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2533 ns 2534 ns 276551 +----------------------------------- +[2025-11-04 11:46:22] >>> Run 2: workload scale = 100 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 100 iterations +============================================= + +2025-11-04T11:46:22+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 4866.2 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.04, 1.03, 0.77 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1958 ns 1959 ns 357126 + +bm_call::via_function_ptr__Function::set_string 1960 ns 1960 ns 357441 +bm_call::via_function_ptr____Method::set_string 1957 ns 1958 ns 357515 + +bm_std::function_calls__Function::set_string 1957 ns 1958 ns 357880 +bm_std::function_calls____Method::set_string 1969 ns 1969 ns 356125 + +bm_rtl::function_calls__Function::set_string 1959 ns 1959 ns 357313 +bm_rtl::method_calls______Method::set_string 1957 ns 1958 ns 357136 + +bm_rtl::function__ErasedReturnType::set_string 1966 ns 1967 ns 355791 +bm_rtl::method____ErasedReturnType::set_string 1968 ns 1968 ns 355742 +bm_rtl::method____ErasedTargetType::set_string 1973 ns 1973 ns 354496 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1978 ns 1979 ns 353748 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2583 ns 2584 ns 270769 + +bm_call::via_function_ptr__Function::get_string 2585 ns 2586 ns 270684 +bm_call::via_function_ptr____Method::get_string 2586 ns 2587 ns 270687 + +bm_std::function_calls__Function::get_string 2591 ns 2592 ns 270101 +bm_std::function_calls____Method::get_string 2592 ns 2593 ns 270162 + +bm_rtl::function_calls__Function::get_string 2588 ns 2589 ns 270376 +bm_rtl::method_calls______Method::get_string 2591 ns 2591 ns 269776 + +bm_rtl::function__ErasedReturnType::get_string 2619 ns 2620 ns 267102 +bm_rtl::method____ErasedReturnType::get_string 2619 ns 2620 ns 267036 +bm_rtl::method____ErasedTargetType::get_string 2601 ns 2602 ns 268965 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2625 ns 2626 ns 266419 +----------------------------------- +[2025-11-04 11:46:43] >>> Run 3: workload scale = 100 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 100 iterations +============================================= + +2025-11-04T11:46:43+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 4684.54 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.09, 1.04, 0.78 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 1958 ns 1958 ns 357642 + +bm_call::via_function_ptr__Function::set_string 1976 ns 1976 ns 354513 +bm_call::via_function_ptr____Method::set_string 1975 ns 1975 ns 354409 + +bm_std::function_calls__Function::set_string 1975 ns 1976 ns 354522 +bm_std::function_calls____Method::set_string 2040 ns 2040 ns 342871 + +bm_rtl::function_calls__Function::set_string 1972 ns 1972 ns 355167 +bm_rtl::method_calls______Method::set_string 1973 ns 1974 ns 354698 + +bm_rtl::function__ErasedReturnType::set_string 1969 ns 1970 ns 355340 +bm_rtl::method____ErasedReturnType::set_string 1974 ns 1975 ns 354492 +bm_rtl::method____ErasedTargetType::set_string 1979 ns 1980 ns 353705 +bm_rtl::method____ErasedTargetAndReturnType::set_string 1982 ns 1982 ns 353134 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2570 ns 2571 ns 272122 + +bm_call::via_function_ptr__Function::get_string 2615 ns 2616 ns 267506 +bm_call::via_function_ptr____Method::get_string 2618 ns 2619 ns 267281 + +bm_std::function_calls__Function::get_string 2618 ns 2618 ns 267315 +bm_std::function_calls____Method::get_string 2658 ns 2658 ns 263345 + +bm_rtl::function_calls__Function::get_string 2616 ns 2617 ns 267494 +bm_rtl::method_calls______Method::get_string 2619 ns 2620 ns 267124 + +bm_rtl::function__ErasedReturnType::get_string 2616 ns 2617 ns 267478 +bm_rtl::method____ErasedReturnType::get_string 2615 ns 2616 ns 267658 +bm_rtl::method____ErasedTargetType::get_string 2591 ns 2592 ns 270061 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2620 ns 2620 ns 266947 +----------------------------------- +[2025-11-04 11:47:04] >>> Run 1: workload scale = 120 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 120 iterations +============================================= + +2025-11-04T11:47:04+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.06, 1.04, 0.78 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 2135 ns 2136 ns 327606 + +bm_call::via_function_ptr__Function::set_string 2134 ns 2135 ns 327517 +bm_call::via_function_ptr____Method::set_string 2134 ns 2135 ns 327554 + +bm_std::function_calls__Function::set_string 2138 ns 2139 ns 327567 +bm_std::function_calls____Method::set_string 2137 ns 2138 ns 326930 + +bm_rtl::function_calls__Function::set_string 2134 ns 2135 ns 328040 +bm_rtl::method_calls______Method::set_string 2134 ns 2135 ns 327050 + +bm_rtl::function__ErasedReturnType::set_string 2140 ns 2141 ns 326742 +bm_rtl::method____ErasedReturnType::set_string 2142 ns 2143 ns 326912 +bm_rtl::method____ErasedTargetType::set_string 2147 ns 2147 ns 326378 +bm_rtl::method____ErasedTargetAndReturnType::set_string 2151 ns 2152 ns 325392 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 2925 ns 2926 ns 239187 + +bm_call::via_function_ptr__Function::get_string 2922 ns 2923 ns 239675 +bm_call::via_function_ptr____Method::get_string 2919 ns 2920 ns 239757 + +bm_std::function_calls__Function::get_string 2922 ns 2923 ns 239511 +bm_std::function_calls____Method::get_string 2927 ns 2927 ns 239088 + +bm_rtl::function_calls__Function::get_string 2921 ns 2922 ns 239587 +bm_rtl::method_calls______Method::get_string 2919 ns 2920 ns 239850 + +bm_rtl::function__ErasedReturnType::get_string 2970 ns 2971 ns 235687 +bm_rtl::method____ErasedReturnType::get_string 2969 ns 2970 ns 235693 +bm_rtl::method____ErasedTargetType::get_string 2939 ns 2940 ns 238228 +bm_rtl::method____ErasedTargetAndReturnType::get_string 2973 ns 2974 ns 235380 +----------------------------------- +[2025-11-04 11:47:25] >>> Run 2: workload scale = 120 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 120 iterations +============================================= + +2025-11-04T11:47:25+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.04, 1.03, 0.79 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 2143 ns 2143 ns 327009 + +bm_call::via_function_ptr__Function::set_string 2144 ns 2144 ns 326962 +bm_call::via_function_ptr____Method::set_string 2143 ns 2143 ns 326336 + +bm_std::function_calls__Function::set_string 2141 ns 2142 ns 326610 +bm_std::function_calls____Method::set_string 2147 ns 2148 ns 325479 + +bm_rtl::function_calls__Function::set_string 2141 ns 2141 ns 326887 +bm_rtl::method_calls______Method::set_string 2141 ns 2142 ns 326810 + +bm_rtl::function__ErasedReturnType::set_string 2149 ns 2149 ns 325633 +bm_rtl::method____ErasedReturnType::set_string 2152 ns 2152 ns 325416 +bm_rtl::method____ErasedTargetType::set_string 2151 ns 2152 ns 325646 +bm_rtl::method____ErasedTargetAndReturnType::set_string 2159 ns 2160 ns 324017 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 3033 ns 3034 ns 230681 + +bm_call::via_function_ptr__Function::get_string 3036 ns 3037 ns 230556 +bm_call::via_function_ptr____Method::get_string 3035 ns 3036 ns 230561 + +bm_std::function_calls__Function::get_string 3036 ns 3037 ns 230558 +bm_std::function_calls____Method::get_string 3044 ns 3045 ns 229777 + +bm_rtl::function_calls__Function::get_string 3036 ns 3036 ns 230539 +bm_rtl::method_calls______Method::get_string 3036 ns 3037 ns 230571 + +bm_rtl::function__ErasedReturnType::get_string 3078 ns 3079 ns 227428 +bm_rtl::method____ErasedReturnType::get_string 3082 ns 3083 ns 227040 +bm_rtl::method____ErasedTargetType::get_string 3052 ns 3053 ns 229389 +bm_rtl::method____ErasedTargetAndReturnType::get_string 3092 ns 3093 ns 226442 +----------------------------------- +[2025-11-04 11:47:47] >>> Run 3: workload scale = 120 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 120 iterations +============================================= + +2025-11-04T11:47:47+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.03, 1.03, 0.80 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 2146 ns 2147 ns 326155 + +bm_call::via_function_ptr__Function::set_string 2146 ns 2146 ns 326275 +bm_call::via_function_ptr____Method::set_string 2146 ns 2146 ns 326240 + +bm_std::function_calls__Function::set_string 2145 ns 2146 ns 325899 +bm_std::function_calls____Method::set_string 2147 ns 2148 ns 325784 + +bm_rtl::function_calls__Function::set_string 2143 ns 2143 ns 326216 +bm_rtl::method_calls______Method::set_string 2144 ns 2144 ns 326155 + +bm_rtl::function__ErasedReturnType::set_string 2152 ns 2153 ns 325106 +bm_rtl::method____ErasedReturnType::set_string 2155 ns 2156 ns 324821 +bm_rtl::method____ErasedTargetType::set_string 2156 ns 2157 ns 324752 +bm_rtl::method____ErasedTargetAndReturnType::set_string 2161 ns 2162 ns 323898 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 3035 ns 3036 ns 230716 + +bm_call::via_function_ptr__Function::get_string 3033 ns 3034 ns 230686 +bm_call::via_function_ptr____Method::get_string 3034 ns 3035 ns 230636 + +bm_std::function_calls__Function::get_string 3034 ns 3034 ns 230656 +bm_std::function_calls____Method::get_string 3047 ns 3048 ns 230042 + +bm_rtl::function_calls__Function::get_string 3040 ns 3041 ns 230018 +bm_rtl::method_calls______Method::get_string 3034 ns 3035 ns 230309 + +bm_rtl::function__ErasedReturnType::get_string 3080 ns 3080 ns 227057 +bm_rtl::method____ErasedReturnType::get_string 3083 ns 3084 ns 226951 +bm_rtl::method____ErasedTargetType::get_string 3056 ns 3057 ns 229016 +bm_rtl::method____ErasedTargetAndReturnType::get_string 3086 ns 3087 ns 226766 +----------------------------------- +[2025-11-04 11:48:09] >>> Run 1: workload scale = 150 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 150 iterations +============================================= + +2025-11-04T11:48:09+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 800 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.02, 1.03, 0.80 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 3513 ns 3514 ns 199230 + +bm_call::via_function_ptr__Function::set_string 3518 ns 3518 ns 199138 +bm_call::via_function_ptr____Method::set_string 3515 ns 3517 ns 199100 + +bm_std::function_calls__Function::set_string 3513 ns 3514 ns 199262 +bm_std::function_calls____Method::set_string 3522 ns 3523 ns 198748 + +bm_rtl::function_calls__Function::set_string 3511 ns 3512 ns 199310 +bm_rtl::method_calls______Method::set_string 3513 ns 3514 ns 199163 + +bm_rtl::function__ErasedReturnType::set_string 3524 ns 3525 ns 198360 +bm_rtl::method____ErasedReturnType::set_string 3524 ns 3525 ns 198512 +bm_rtl::method____ErasedTargetType::set_string 3528 ns 3529 ns 198173 +bm_rtl::method____ErasedTargetAndReturnType::set_string 3534 ns 3535 ns 198093 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 4425 ns 4426 ns 158169 + +bm_call::via_function_ptr__Function::get_string 4427 ns 4429 ns 158159 +bm_call::via_function_ptr____Method::get_string 4427 ns 4428 ns 158046 + +bm_std::function_calls__Function::get_string 4425 ns 4427 ns 158030 +bm_std::function_calls____Method::get_string 4437 ns 4438 ns 157709 + +bm_rtl::function_calls__Function::get_string 4426 ns 4427 ns 158157 +bm_rtl::method_calls______Method::get_string 4429 ns 4430 ns 158050 + +bm_rtl::function__ErasedReturnType::get_string 4477 ns 4478 ns 156294 +bm_rtl::method____ErasedReturnType::get_string 4477 ns 4479 ns 156172 +bm_rtl::method____ErasedTargetType::get_string 4454 ns 4456 ns 157109 +bm_rtl::method____ErasedTargetAndReturnType::get_string 4486 ns 4487 ns 155951 +----------------------------------- +[2025-11-04 11:48:34] >>> Run 2: workload scale = 150 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 150 iterations +============================================= + +2025-11-04T11:48:34+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 4900.01 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.01, 1.02, 0.81 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 3523 ns 3524 ns 198828 + +bm_call::via_function_ptr__Function::set_string 3520 ns 3521 ns 199061 +bm_call::via_function_ptr____Method::set_string 3524 ns 3525 ns 198822 + +bm_std::function_calls__Function::set_string 3518 ns 3519 ns 198928 +bm_std::function_calls____Method::set_string 3530 ns 3531 ns 198583 + +bm_rtl::function_calls__Function::set_string 3521 ns 3522 ns 198936 +bm_rtl::method_calls______Method::set_string 3525 ns 3526 ns 198848 + +bm_rtl::function__ErasedReturnType::set_string 3527 ns 3528 ns 198359 +bm_rtl::method____ErasedReturnType::set_string 3527 ns 3528 ns 197890 +bm_rtl::method____ErasedTargetType::set_string 3534 ns 3535 ns 197890 +bm_rtl::method____ErasedTargetAndReturnType::set_string 3536 ns 3537 ns 197487 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 4456 ns 4457 ns 157300 + +bm_call::via_function_ptr__Function::get_string 4449 ns 4450 ns 157301 +bm_call::via_function_ptr____Method::get_string 4457 ns 4458 ns 157197 + +bm_std::function_calls__Function::get_string 4449 ns 4450 ns 157266 +bm_std::function_calls____Method::get_string 4458 ns 4460 ns 156701 + +bm_rtl::function_calls__Function::get_string 4455 ns 4456 ns 157313 +bm_rtl::method_calls______Method::get_string 4451 ns 4453 ns 157215 + +bm_rtl::function__ErasedReturnType::get_string 4495 ns 4497 ns 155850 +bm_rtl::method____ErasedReturnType::get_string 4494 ns 4495 ns 155702 +bm_rtl::method____ErasedTargetType::get_string 4470 ns 4471 ns 156262 +bm_rtl::method____ErasedTargetAndReturnType::get_string 4508 ns 4510 ns 155393 +----------------------------------- +[2025-11-04 11:48:59] >>> Run 3: workload scale = 150 + +======== RTL Benchmark Configuration ======== +Workload: concatenate string of length 500 +Scale : 150 iterations +============================================= + +2025-11-04T11:48:59+05:30 +Running ./bin/RTLBenchmarkApp +Run on (16 X 2162.72 MHz CPU s) +CPU Caches: + L1 Data 48 KiB (x8) + L1 Instruction 32 KiB (x8) + L2 Unified 1280 KiB (x8) + L3 Unified 20480 KiB (x1) +Load Average: 1.01, 1.02, 0.82 +-------------------------------------------------------------------------------------------------- +Benchmark Time CPU Iterations +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::set_string 3504 ns 3505 ns 199689 + +bm_call::via_function_ptr__Function::set_string 3505 ns 3506 ns 199740 +bm_call::via_function_ptr____Method::set_string 3504 ns 3505 ns 199829 + +bm_std::function_calls__Function::set_string 3502 ns 3503 ns 199609 +bm_std::function_calls____Method::set_string 3512 ns 3513 ns 199226 + +bm_rtl::function_calls__Function::set_string 3505 ns 3506 ns 199956 +bm_rtl::method_calls______Method::set_string 3504 ns 3505 ns 199794 + +bm_rtl::function__ErasedReturnType::set_string 3519 ns 3520 ns 198946 +bm_rtl::method____ErasedReturnType::set_string 3518 ns 3519 ns 198913 +bm_rtl::method____ErasedTargetType::set_string 3525 ns 3526 ns 198501 +bm_rtl::method____ErasedTargetAndReturnType::set_string 3525 ns 3526 ns 198610 +-------------------------------------------------------------------------------------------------- +bm_call::direct__Function::get_string 4431 ns 4432 ns 157921 + +bm_call::via_function_ptr__Function::get_string 4440 ns 4441 ns 157629 +bm_call::via_function_ptr____Method::get_string 4441 ns 4442 ns 157533 + +bm_std::function_calls__Function::get_string 4440 ns 4441 ns 157655 +bm_std::function_calls____Method::get_string 4437 ns 4438 ns 157742 + +bm_rtl::function_calls__Function::get_string 4439 ns 4440 ns 157633 +bm_rtl::method_calls______Method::get_string 4441 ns 4443 ns 157563 + +bm_rtl::function__ErasedReturnType::get_string 4470 ns 4471 ns 156524 +bm_rtl::method____ErasedReturnType::get_string 4472 ns 4474 ns 156472 +bm_rtl::method____ErasedTargetType::get_string 4448 ns 4449 ns 157314 +bm_rtl::method____ErasedTargetAndReturnType::get_string 4478 ns 4479 ns 156261 +----------------------------------- +All benchmarks completed. diff --git a/text-sailors-log/reflection-apis-redefined.md b/text-sailors-log/reflection-apis-redefined.md new file mode 100644 index 00000000..137ac67c --- /dev/null +++ b/text-sailors-log/reflection-apis-redefined.md @@ -0,0 +1,514 @@ +Design log, 06/11/2025 +Author, Neeraj Singh. +------------------------------------- +# Why RTL's API is Different + +Most C++ reflection libraries follow patterns inherited from dynamically-typed languages like Python, Ruby, or JavaScript. These patterns make sense in those contexts—but they're fundamentally mismatched to C++'s nature as a statically-typed, performance-oriented language. + +RTL takes a different approach: **leverage C++'s type system instead of fighting it**. + +--- + +## The Traditional Reflection Model: "Shooting in the Dark" + +**The typical reflection API looks like this:** + +```cpp +// Traditional reflection (most libraries) +result = invoke("functionName", arg1, arg2, arg3); +``` + +**What happens at runtime:** + +1. **Lookup:** Hash map search for "functionName" (~10-50ns) +2. **Arity check:** Does argument count match? (~5ns) +3. **Type validation:** Do argument types match expected types? (~10-30ns) +4. **Type conversion:** Convert arguments if possible (~10-50ns) +5. **Dispatch:** Finally, call the function (~1-2ns) + +**If any step 1-4 fails:** Throw exception (after consuming all that time). + +**If you call this function 1,000 times:** Pay the lookup + validation cost 1,000 times. + +--- + +### **The Problems with This Model** + +#### **1. Performance Degrades at Scale** + +```cpp +// Every call repeats the entire lookup + validation process +for (int i = 0; i < 1000000; i++) { + invoke("processData", data[i]); // 1M × (lookup + validate + dispatch) +} +``` + +**Cost per call:** 30-100ns overhead, even if the function itself is fast. + +For a trivial function (say, 5ns of actual work), **you're spending 85-95% of time on reflection overhead**. + +--- + +#### **2. Error Handling is Reactive, Not Proactive** + +```cpp +try { + result = invoke("funcName", arg1, arg2); +} catch (const ReflectionException& e) { + // What failed? + // - Function not found? + // - Wrong argument count? + // - Type mismatch? + // - Can't convert types? + + // Parse error message to figure it out? 😞 +} +``` + +**You discover errors during the call, not before.** + +Every invocation is a gamble: will it work, or will it throw? + +--- + +#### **3. User Intent is Ambiguous** + +```cpp +invoke("compute", 42, 3.14); +``` + +**Questions the library must guess:** +- Is this a function taking `(int, double)`? +- Or `(double, double)` with int→double conversion? +- Or `(float, float)` with narrowing conversions? +- Or `(long, float)` with multiple conversions? + +**The library guesses. Sometimes it guesses wrong.** + +--- + +## The RTL Model: "Turn On the Lights First" + +RTL separates reflection into **two distinct phases**: + +### **Phase 1: Lookup & Validation (Once)** + +```cpp +rtl::function compute = + mirror.getFunction("compute") + ->argsT() + .returnT(); + +if (!compute) { + // Function doesn't exist or signature doesn't match + // Handle this ONCE, at setup time + std::cerr << "Function 'compute' not found or signature mismatch\n"; + return; +} +``` + +**This is where you "agree and commit":** +- "I want a function named `compute`" +- "That takes `(float, float)`" +- "And returns `std::string`" + +**If this succeeds:** You have a **valid, typed callable**. Invocation is guaranteed to work. + +**If this fails:** You get an empty `optional`. Handle it gracefully, once. + +--- + +### **Phase 2: Dispatch (Many Times, Zero Overhead)** + +```cpp +// Now call it as many times as you want +for (int i = 0; i < 1000000; i++) { + std::string result = compute(data[i].x, data[i].y); // Just dispatch +} +``` + +**What happens per call:** +1. **Dispatch:** Jump to function pointer (~1-2ns) +2. Done. + +**No lookup. No validation. No type checking. No exceptions.** + +**Just a single, native function pointer jump.** + +--- + +## Why This is Architecturally Superior + +### **1. Performance: Amortize the Cost** + +**Traditional Model:** +``` +Total cost = N × (Lookup + Validate + Dispatch) +1,000 calls = 1,000 × (50ns) = 50,000ns = 50µs +``` + +**RTL Model:** +``` +Total cost = 1 × (Lookup + Validate) + N × (Dispatch) +1,000 calls = 1 × (50ns) + 1,000 × (2ns) = 2,050ns = 2µs +``` + +**RTL is 24× faster for 1,000 calls.** + +**The more you call, the bigger RTL's advantage.** + +--- + +### **2. Error Handling: Fail Fast** + +**Traditional:** +```cpp +try { + for (auto& item : data) { + invoke("process", item); // Might fail on iteration 847 + } +} catch (...) { + // Crashed mid-loop. Now what? +} +``` + +**RTL:** +```cpp +auto process = mirror.getFunction("process")->argsT().returnT<>(); + +if (!process) { + // Failed at setup. Handle it BEFORE the loop. + return error("Function 'process' not found"); +} + +// If we get here, all 1,000 calls are guaranteed to work: +for (auto& item : data) { + process(item); // No try-catch needed +} +``` + +**Errors are discovered at lookup time, not call time.** + +**"Fail fast" done right.** + +--- + +### **3. User Intent is Explicit** + +**Traditional (ambiguous):** +```cpp +invoke("func", 42, 3.14); // What signature does user expect? +``` + +**RTL (explicit):** +```cpp +rtl::function func = ...; // User declares intent +func(42, 3.14); // Compiler enforces it +``` + +**No guessing. User's expectations are crystal clear.** + +--- + +### **4. Composability** + +RTL's callables are **first-class objects**: + +```cpp +// Store them +std::map> handlers; +handlers["onConnect"] = mirror.getFunction("handleConnect")->argsT(); +handlers["onDisconnect"] = mirror.getFunction("handleDisconnect")->argsT(); + +// Pass them around +void registerHandler(const std::string& event, rtl::function handler); + +// Compose them +auto combined = [f1, f2](int x) { f1(x); f2(x); }; +``` + +**You can't do this with `invoke("name", ...)` — the lookup is coupled to the call.** + +--- + +## The Type System is Your Friend + +### **Insight: Types Exist at the Call Site** + +When you write: +```cpp +int x = 42; +float y = 3.14f; +invoke("compute", x, y); +``` + +**The compiler knows `x` is `int` and `y` is `float`.** + +**Why throw away that information just to rediscover it at runtime?** + +--- + +### **RTL's Philosophy:** + +> **"C++ is statically typed. Users write typed code. Reflection should use those types, not fight them."** + +When you write: +```cpp +rtl::function compute = ...; +compute(x, y); +``` + +**The compiler:** +- Knows you're calling a function expecting `(int, float)` +- Knows you're passing `(int, float)` +- Validates this at compile time (if variables are typed) +- Generates the call with zero overhead + +**RTL just forwards the arguments. The compiler does the rest.** + +--- + +## The Two Design Decisions That Make This Work + +### **Decision 1: Let C++ Handle Implicit Conversions** + +**Most reflection libraries try to implement conversion logic:** + +```cpp +// What other libraries do (pseudocode): +if (arg_type == int && param_type == float) { + float converted = static_cast(arg); + // Now handle: double, long, short, unsigned... + // Also handle: const, pointers, references... + // Also handle: user-defined conversions... + // 5,000 lines later... +} +``` + +**RTL's approach:** + +```cpp +// User declares expected types +rtl::function func = ...; + +// User passes ints +func(61, 35); // Compiler converts int→float (standard C++) +``` + +**RTL doesn't handle conversions. C++ does.** + +**Benefits:** +- ✅ Zero conversion code to write/maintain +- ✅ Zero runtime overhead (compiler optimizes) +- ✅ All standard conversions work automatically +- ✅ User-defined conversions work automatically +- ✅ Perfect forwarding works +- ✅ Const-correctness preserved + +**RTL leverages the compiler instead of reimplementing it.** + +--- + +### **Decision 2: Decouple Lookup from Invocation** + +**Most libraries couple them:** +```cpp +invoke(name, args) = [Lookup + Validate + Call] as one operation +``` + +**RTL decouples them:** +```cpp +callable = lookup(name, signature) // Once +callable(args) // Many times +``` + +**This separation gives you:** +- ✅ Performance (amortize lookup cost) +- ✅ Safety (validate once, call many) +- ✅ Clarity (errors at lookup, not call) +- ✅ Composability (callables are values) + +**Single Responsibility Principle applied to reflection.** + +--- + +## A Complete Example: Before and After + +### **Traditional Reflection Library** + +```cpp +// Setup (none needed, everything happens at call-time) + +// Usage +void processData(const std::vector& data) { + for (const auto& point : data) { + try { + // Every call: lookup + validate + dispatch + auto result = reflection::invoke("computeValue", point.x, point.y); + + // Type-cast the result (runtime check) + double value = std::any_cast(result); + + // Use value... + } catch (const reflection::NotFoundException& e) { + // Function not found + } catch (const reflection::TypeMismatchException& e) { + // Type error + } catch (const std::bad_any_cast& e) { + // Wrong return type + } + } +} +``` + +**Problems:** +- ❌ Lookup + validation × N times (slow) +- ❌ Three different exception types to catch +- ❌ Runtime type casting required +- ❌ Errors discovered during loop (too late) + +--- + +### **RTL Approach** + +```cpp +// Setup (once, at initialization) +auto computeValue = mirror.getFunction("computeValue") + ->argsT() + .returnT(); + +if (!computeValue) { + // Handle error at setup time + return error("Function 'computeValue' not found or signature mismatch"); +} + +// Usage +void processData(const std::vector& data) { + for (const auto& point : data) { + // Just dispatch (no lookup, no validation, no exceptions) + double value = computeValue(point.x, point.y); + + // Use value... + } +} +``` + +**Benefits:** +- ✅ Lookup + validation once (fast) +- ✅ Zero exception handling in loop +- ✅ Statically typed result (no casting) +- ✅ Errors discovered before loop (fail fast) + +--- + +## When to Use Each API Style + +RTL provides **two APIs** for different scenarios: + +### **Typed API (When You Know Types)** + +```cpp +// You know the signature at the call site +rtl::function func = + mirror.getFunction("toString") + ->argsT() + .returnT(); + +std::string result = func(42, 100); // Compile-time type checking +``` + +**Use when:** +- You know the function signature +- You want compile-time type safety +- You need maximum performance (~1-2ns overhead) + +--- + +### **Type-Erased API (When Types are Unknown)** + +```cpp +// Runtime flexibility when types aren't known at compile time +auto [err, result] = mirror.getFunction("toString") + ->bind(obj) + .call(42, 100); + +if (err == rtl::error::None && result.canViewAs()) { + std::string str = result.view()->get(); +} +``` + +**Use when:** +- Loading plugins at runtime +- Scripting language integration +- Serialization/deserialization +- Generic tool building (debuggers, editors) + +**Even the type-erased API separates lookup from invocation:** +- Lookup: `getFunction("toString")` +- Invocation: `call(args)` + +--- + +## The Philosophy: "Ask, Don't Assume" + +**Traditional reflection:** +```cpp +invoke("func", args); // Hope it works, catch if it doesn't +``` + +**RTL:** +```cpp +auto func = mirror.getFunction("func")->argsT(); +if (func) { + func(args); // Guaranteed to work +} else { + // Handle the known error +} +``` + +**Instead of assuming the function exists and catching exceptions when it doesn't, RTL lets you ASK:** + +- "Does this function exist?" +- "Does it have this signature?" +- "Give me a callable if yes, null if no." + +**Then you decide what to do.** + +**This is:** +- More explicit (no hidden exceptions) +- More efficient (no wasted work on invalid calls) +- More composable (callables are values) + +--- + +## Summary: Two Key Insights + +### **1. C++ Has Types — Use Them** + +**Don't throw away type information just to rediscover it at runtime.** + +Let users declare expected types. Let the compiler handle conversions and validation. Reflection becomes a thin layer, not a complex runtime system. + +--- + +### **2. Separate Lookup from Dispatch** + +**Don't couple lookup + validation with every call.** + +Validate once at setup. Then dispatch becomes a single function pointer jump — as fast as C++ can possibly be. + +--- + +## The Result + +**RTL reflection calls are 10-50× faster than traditional reflection.** + +**Not through clever optimization tricks.** + +**Through better architecture.** + +--- + +**By thinking in C++ instead of copying dynamic languages, RTL achieves both flexibility AND performance.** + +**That's the RTL difference.**