Add C++11 optimization features 'std::move', '=default' for trivial de/constructors

Declined
#12 · Created  · Last updated

Declined pull request

Inacceptable

Closed by: ·2022-11-04

Description

Hello @oleh-derevenko,

This PR changes have:
- Excess const reference parameter float removed. Сonst reference param works optimized only on classes, type, structures which can effectively fit into size registers on x64 processors.
Example:

object size 16 bytes

struct SixteenBytes { int64_t firstHalf; // 8-byte int64_t secondHalf; // 8-byte }; // 16-bytes uint32_t foo_16(SixteenBytes obj) noexcept { return obj.firstHalf + obj.secondHalf; }

assembly output

foo_16(SixteenBytes): # @foo_16(SixteenBytes) lea eax, [rsi + rdi] ret

 

object size 24 bytes

struct MoreThanSixteenBytes { int64_t firstHalf; // 8-byte int64_t secondHalf; // 8-byte int32_t yetAnotherStuff; // 4-byte }; // 24-bytes uint32_t foo_more_than_16(MoreThanSixteenBytes obj) noexcept { return obj.firstHalf + obj.secondHalf + obj.yetAnotherStuff; }

assembly output

foo_more_than_16(MoreThanSixteenBytes): mov eax, dword ptr [rsp + 16] add eax, dword ptr [rsp + 8] add eax, dword ptr [rsp + 24] ret
  • Many definitions of trivial constructors and destructors according to standard C++11

  • Using std::move(NotUsedObject) for optimization where possible

To test PR changes, building demos with compiler's best optimization flag and create more objects in the scene.

I’m tested on Ubuntu 22.04 amd64 building on GCC

 

0 attachments

0 comments

Loading commits...