Closed sinandredemption closed 3 years ago
way we can increase the number of test cases per operator?
Great idea. I believe the number of testsis hard-coded to 1000 in a bunch of lines like this in the file performance_test.hpp.
Since you are doing tests relative one type to another, simply jump those lines up to 10,000 or 100,000 I think. If that does not work, please get back to me.
Here are the preliminary results for performance of double-float.
Operator | cpp_bin_float | cpp_double_fp_backend |
---|---|---|
* | 11.114 (0.362158s) | [*1] (0.0325857s) |
*(int) | 7.27636 (0.242081s) | [*1] (0.0332695s) |
*(unsigned long long) | 4.3046 (0.306152s) | [*1] (0.0711219s) |
*=(unsigned long long) | 7.6058 (0.303511s) | [*1] (0.0399052s) |
+ | 5.60299 (0.377083s) | [*1] (0.0673002s) |
+(int) | 8.00336 (0.440066s) | [*1] (0.0549851s) |
+(unsigned long long) | 7.48374 (0.466146s) | [*1] (0.0622879s) |
+=(unsigned long long) | 9.05229 (0.440637s) | [*1] (0.0486769s) |
- | 7.12818 (0.39518s) | [*1] (0.0554391s) |
-(int) | 7.69794 (0.447368s) | [*1] (0.0581152s) |
-(unsigned long long) | 6.90328 (0.455248s) | [*1] (0.0659466s) |
-=(unsigned long long) | 8.97643 (0.496401s) | [*1] (0.0553005s) |
/ | 4.35787 (4.21081s) | [*1] (0.966254s) |
/(int) | 1.38088 (0.632865s) | [*1] (0.458306s) |
/(unsigned long long) | 3.60605 (1.64141s) | [*1] (0.455182s) |
/=(unsigned long long) | 4.03905 (1.73374s) | [*1] (0.429245s) |
construct | 3.10884 (0.188684s) | [*1] (0.0606926s) |
construct(unsigned long long) | 9.86198 (1.43813s) | [*1] (0.145825s) |
construct(unsigned) | 21.2099 (1.39659s) | [*1] (0.0658462s) |
str | 1.23162 (0.0016888s) | [*1] (0.0013712s) |
A few platform details:
Platform: Windows x64
Compiler: Microsoft Visual C++ version 14.2
Boost: 107500
EDIT: cpp_bin_float
was running at 31 decimal digits of precision
Really nice numbers Fahad. We concentrated so much on quad recently, I was actually thinking that one of the real benefits of this GSoC's results will be the good 'ol cpp_double_fp_backend
instantiated for either double
or long
double
.
Great job! @sinandredemption
Cc: @cosurgi and @jzmaddock
@sinandredemption I confirm your benchmark methodology for double-float.
On GCC 9 running on Ubuntu, I got the following raw data with factors of 5-10 speedup on arithmetic ops:
operation | cpp_bin_float | cpp_double_fp_backend |
---|---|---|
+ | 0.244161 | 0.030418 |
- | 0.241686 | 0.0284256 |
* | 0.125933 | 0.0163531 |
/ | 2.30554 | 0.473302 |
str | 0.001701 | 0.002918 |
+(int) | 0.229878 | 0.0281554 |
-(int) | 0.242622 | 0.0269989 |
*(int) | 0.118462 | 0.0134481 |
/(int) | 0.487138 | 0.218203 |
construct | 0.336057 | 0.0470241 |
construct(unsigned) | 0.237162 | 0.0841882 |
construct(unsigned long long) | 0.211154 | 0.11853 |
+(unsigned long long) | 0.27494 | 0.027713 |
-(unsigned long long) | 0.250832 | 0.0278098 |
*(unsigned long long) | 0.126704 | 0.0154193 |
/(unsigned long long) | 0.552782 | 0.175357 |
+=(unsigned long long) | 0.261626 | 0.0279107 |
-=(unsigned long long) | 0.242469 | 0.0279352 |
*=(unsigned long long) | 0.125763 | 0.0165767 |
/=(unsigned long long) | 0.53905 | 0.184863 |
On GCC 9 running on Ubuntu,
Note to self: Remember to test on MSVC with /fp:fast
and/or GCC with -ffast-math
. I will integrate some -ffast-math
runs in CI and see if that also influences perf numbers.
Cc: @sinandredemption and @cosurgi
This issue is (for the GSoC'21 purposes) done.
As soon as my current PR goes green, I will present a PR in which
cpp_double_fp_backend
is tested againstcpp_bin_float
of the appropriate size.In the preliminary tests, it seems to me just a thousand operations is too few to accurately judge how the two types compare. Is their any way we can increase the number of test cases per operator?
CC @ckormanyos @cosurgi