|
Boost : |
Subject: Re: [boost] [math] Enable move semantics for polynomials
From: Lakshay Garg (lakshayg373_at_[hidden])
Date: 2017-08-14 05:44:59
>
> Hello all
>>
>> The polynomial class in boost.math does not support move sematics. I tried
>> to implement them and found that they immediately lead to significant
>> improvements in performance (benchmarking using google-benchmark).
>>
>
Here are some benchmarking results:
âRun on (1 X 2394.45 MHz CPU ) Run on (1 X 2394.45
MHz CPU )
2017-08-14 05:20:24 2017-08-14 05:21:31
------------------------------------- ------------------------------------
Benchmark Time Iterations Benchmark Time Iterations
------------------------------------- ------------------------------------
[[ move construction ]] [[ copy construction ]]
constr/1 2 ns 343554733 constr/1 31 ns 22353034
constr/8 2 ns 343350386 constr/8 52 ns 10000000
constr/64 3 ns 344426801 constr/64 114 ns 6089098
constr/512 2 ns 207412914 constr/512 122 ns 5712918
constr/4096 2 ns 338440949 constr/4096 2076 ns 467209
[[ unmodified from boost version ]]
mult/1 92 ns 10456937 mult/1 111 ns 6406373
mult/8 202 ns 3296293 mult/8 126 ns 5272682
mult/64 1845 ns 377277 mult/64 2069 ns 375123
mult/512 111874 ns 7214 mult/512 159189 ns 4393
mult/4096 12454282 ns 56 mult/4096 12539754 ns 56
[[ addition using move semantics ]] [[ boost addition w/ const lvalue
ref ]]
add/1 63 ns 8470126 add/1 256 ns 2726596
add/8 64 ns 10869408 add/8 318 ns 2203414
add/64 247 ns 3707535 add/64 617 ns 1105630
add/512 1352 ns 512563 add/512 1330 ns 526513
add/4096 8146 ns 81454 add/4096 15984 ns 49450
[[ unmodified from boost version ]]
inplaceAdd/1 8 ns 105715477 inplaceAdd/1 11 ns 64811794
inplaceAdd/8 16 ns 42666675 inplaceAdd/8 12 ns 44115677
inplaceAdd/64 33 ns 17414051 inplaceAdd/64 34 ns 20628203
inplaceAdd/512 181 ns 4483653 inplaceAdd/512 246 ns 4431873
inplaceAdd/4096 2737 ns 255393 inplaceAdd/4096 2766 ns 254879
[[ total heap usage ]]
308,365,390 bytes allocated 1,940,239,990 bytes allocated
â
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk