Add std::move support to KisPaintInformation
AbandonedPublic

Authored by alvinhochun on Jul 8 2017, 6:37 PM.

Details

Reviewers
None
Group Reviewers
Krita
Summary

Add std::move support to KisPaintInformation

This adds a move constructor and move assignment operator in KisPaintInformation to allow use of move. Whenever move can be used, it will now prevent a pointless heap allocation and deallocation.

This commit does not add any std::move, so only code where the compiler can automatically use a move (e.g. return value) would see a performance gain.

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped
alvinhochun created this revision.Jul 8 2017, 6:37 PM
Restricted Application added a subscriber: woltherav. ยท View Herald TranscriptJul 8 2017, 6:37 PM

Should I also create a task on optimizing existing code to actually use std::move?

Do you have any numbers showing that this move semantics optimizes anything? If we really want to go this way (get down to optimizing pointers), we should probably try to use QSharedData thing. This class is used by Qt everywhere to implement lazy copying of data.

But I still have a feeling that we can somehow optimize the mixing mixing code to avoid the copy-ctors entirely... Your backtrace says that mixing code takes quite a lot of time in it, so we could possibly optimize the mix code for somehow...

Do you have any numbers showing that this move semantics optimizes anything? If we really want to go this way (get down to optimizing pointers), we should probably try to use QSharedData thing. This class is used by Qt everywhere to implement lazy copying of data.

No numbers, but I figured it would be a rather small difference anyway. It seems like trying`QSharedData` might make more of a difference. There are several places that makes copies without needing to modify the data (mostly copying into and out of containers).

But I still have a feeling that we can somehow optimize the mixing mixing code to avoid the copy-ctors entirely... Your backtrace says that mixing code takes quite a lot of time in it, so we could possibly optimize the mix code for somehow...

Here: D6578

alvinhochun planned changes to this revision.Jul 9 2017, 7:16 AM
alvinhochun abandoned this revision.Jul 12 2017, 3:02 PM