aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/st.c
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-08-17 11:30:56 +0100
committerJonathan Wakely <jwakely@redhat.com>2021-08-17 14:22:50 +0100
commit0808b0df9c4d31f4c362b9c85fb538b6aafcb517 (patch)
treefbf9bc63af60b82ece376b9c2d7ed612e3a08ad8 /gcc/fortran/st.c
parent3b3f2f7c265ef9f176cb811a8049b24538d954d9 (diff)
downloadgcc-0808b0df9c4d31f4c362b9c85fb538b6aafcb517.zip
gcc-0808b0df9c4d31f4c362b9c85fb538b6aafcb517.tar.gz
gcc-0808b0df9c4d31f4c362b9c85fb538b6aafcb517.tar.bz2
libstdc++: Optimize std::function move constructor [PR101923]
PR 101923 points out that the unconditional swap in the std::function move constructor makes it slower than copying an empty std::function. The copy constructor has to check for the empty case before doing anything, and that makes it very fast for the empty case. Adding the same check to the move constructor avoids copying the _Any_data POD when we don't need to. We can also inline the effects of swap, by copying each member and then zeroing the pointer members. This makes moving an empty object at least as fast as copying an empty object. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: PR libstdc++/101923 * include/bits/std_function.h (function(function&&)): Check for non-empty parameter before doing any work.
Diffstat (limited to 'gcc/fortran/st.c')
0 files changed, 0 insertions, 0 deletions