[PATCH 00/14] Optimize integral-related type traits
Ken Matsui
kmatsui@gcc.gnu.org
Wed Jan 10 09:22:51 GMT 2024
This patch series implements __is_integral, __is_floating_point,
__is_arithmetic, __is_unsigned, __is_signed, and __is_scalar built-in
traits and optimizes std::is_integral, std::is_floating_point,
std::is_arithmetic, std::is_unsigned, std::is_signed, std::is_scalar,
std::is_fundamental, and std::is_compound compilation performance.
Here are the benchmark results:
std::is_integral: https://github.com/ken-matsui/gcc-bench/blob/main/is_integral.md#wed-jan-10-112014-am-pst-2024
Time: -28.5606%, Peak Mem: -25.0022%, Total Mem: -22.4503%
std::is_integral_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_integral_v.md#wed-jan-10-112014-am-pst-2024
Time: -44.9068%, Peak Mem: -37.046%, Total Mem: -36.3088%
std::is_floating_point: https://github.com/ken-matsui/gcc-bench/blob/main/is_floating_point.md#wed-jan-10-112014-am-pst-2024
Time: -22.1413%, Peak Mem: -24.9831%, Total Mem: -22.4503%
std::is_floating_point_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_floating_point_v.md#wed-jan-10-112014-am-pst-2024
Time: -44.9223%, Peak Mem: -37.0304%, Total Mem: -36.2869%
std::is_arithmetic: https://github.com/ken-matsui/gcc-bench/blob/main/is_arithmetic.md#wed-jan-10-112014-am-pst-2024
Time: -67.5805%, Peak Mem: -55.3318%, Total Mem: -58.5106%
std::is_arithmetic_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_arithmetic_v.md#wed-jan-10-112014-am-pst-2024
Time: -74.1939%, Peak Mem: -61.3623%, Total Mem: -64.8586%
std::is_fundamental: https://github.com/ken-matsui/gcc-bench/blob/main/is_fundamental.md#wed-jan-10-112014-am-pst-2024
Time: -62.5392%, Peak Mem: -49.5002%, Total Mem: -53.3734%
std::is_fundamental_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_fundamental_v.md#wed-jan-10-112014-am-pst-2024
Time: -56.9926%, Peak Mem: -49.3151%, Total Mem: -53.8913%
std::is_compound: https://github.com/ken-matsui/gcc-bench/blob/main/is_compound.md#wed-jan-10-112014-am-pst-2024
Time: -56.3176%, Peak Mem: -45.7971%, Total Mem: -49.4637%
std::is_compound_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_compound_v.md#wed-jan-10-112014-am-pst-2024
Time: -56.0783%, Peak Mem: -47.7484%, Total Mem: -52.5631%
std::is_unsigned: https://github.com/ken-matsui/gcc-bench/blob/main/is_unsigned.md#wed-jan-10-112014-am-pst-2024
Time: -75.9165%, Peak Mem: -65.632%, Total Mem: -68.8883%
std::is_unsigned_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_unsigned_v.md#wed-jan-10-112014-am-pst-2024
Time: -81.7237%, Peak Mem: -70.1175%, Total Mem: -73.4473%
std::is_signed: https://github.com/ken-matsui/gcc-bench/blob/main/is_signed.md#wed-jan-10-112014-am-pst-2024
Time: -72.8341%, Peak Mem: -61.9239%, Total Mem: -64.5455%
std::is_signed_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_signed_v.md#wed-jan-10-112014-am-pst-2024
Time: -79.9365%, Peak Mem: -66.9684%, Total Mem: -69.8372%
std::is_scalar: https://github.com/ken-matsui/gcc-bench/blob/main/is_scalar.md#wed-jan-10-112014-am-pst-2024
Time: -87.2356%, Peak Mem: -79.0888%, Total Mem: -82.2095%
std::is_scalar_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_scalar_v.md#wed-jan-10-112014-am-pst-2024
Time: -89.5349%, Peak Mem: -83.2528%, Total Mem: -85.6074%
Ken Matsui (14):
c++: Implement __is_integral built-in trait
libstdc++: Optimize std::is_integral compilation performance
c++: Implement __is_floating_point built-in trait
libstdc++: Optimize std::is_floating_point compilation performance
c++: Implement __is_arithmetic built-in trait
libstdc++: Optimize std::is_arithmetic compilation performance
libstdc++: Optimize std::is_fundamental compilation performance
libstdc++: Optimize std::is_compound compilation performance
c++: Implement __is_unsigned built-in trait
libstdc++: Optimize std::is_unsigned compilation performance
c++: Implement __is_signed built-in trait
libstdc++: Optimize std::is_signed compilation performance
c++: Implement __is_scalar built-in trait
libstdc++: Optimize std::is_scalar compilation performance
gcc/cp/constraint.cc | 18 ++++
gcc/cp/cp-trait.def | 6 ++
gcc/cp/semantics.cc | 65 +++++++++++-
gcc/testsuite/g++.dg/ext/has-builtin-1.C | 18 ++++
gcc/testsuite/g++.dg/ext/is_arithmetic.C | 31 ++++++
gcc/testsuite/g++.dg/ext/is_floating_point.C | 43 ++++++++
gcc/testsuite/g++.dg/ext/is_integral.C | 49 +++++++++
gcc/testsuite/g++.dg/ext/is_scalar.C | 28 +++++
gcc/testsuite/g++.dg/ext/is_signed.C | 45 +++++++++
gcc/testsuite/g++.dg/ext/is_unsigned.C | 45 +++++++++
libstdc++-v3/include/std/type_traits | 101 ++++++++++++++++++-
11 files changed, 441 insertions(+), 8 deletions(-)
create mode 100644 gcc/testsuite/g++.dg/ext/is_arithmetic.C
create mode 100644 gcc/testsuite/g++.dg/ext/is_floating_point.C
create mode 100644 gcc/testsuite/g++.dg/ext/is_integral.C
create mode 100644 gcc/testsuite/g++.dg/ext/is_scalar.C
create mode 100644 gcc/testsuite/g++.dg/ext/is_signed.C
create mode 100644 gcc/testsuite/g++.dg/ext/is_unsigned.C
--
2.43.0
More information about the Libstdc++
mailing list