Skip to content

Dev Notes: 2017_01_21

Dave Hudson edited this page Jan 21, 2017 · 5 revisions

Continuing Performance Investigations

The numbers from yesterday strongly indicated that we were spending a lot of CPU time in memory management. The most obvious place that we could be spending this would be the creation and deletion of temporary natural number objects during our calculations.

Starting with C++11, one of the major performance improvements came from the ability to use move constructors and move assignment operators. By default our natural number class supported these, but it wasn't clear if we were actually moving, rather than copying, everywhere that we should have been.

In theory we could just check our binary output and look for uses of the various constructors and operators, but a pretty simple approach is simply to add non-default versions and then trace their use.

Doing this showed up some specific problems related to the use of std::pair. By using std::move() quite a number of copy operations could be replaced with more efficient moves. The relevant commit is b04347b037f17af66ef8a397248288508bff7024.

See Also

Clone this wiki locally