This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ping][PATCH] Separate benchmarks for fast and slow paths of pow and exp


On 04/01/2013 02:48 AM, Siddhesh Poyarekar wrote:
> Ping!
>
> On Wed, Mar 20, 2013 at 04:10:00PM +0530, Siddhesh Poyarekar wrote:
>> Hi,
>>
>> This patch uses the earlier Rules tweak to separate the benchmark
>> results for fast and slow paths of exp and pow since those results
>> don't make sense together.  The patch also adjusts the number of
>> iterations to make each benchmark last ~10 sec (give or take a couple
>> of seconds) on my system.  Mileage may vary on other systems, but the
>> idea is to make the number of iterations high enough and roughly
>> comparable.
>>
>> Here's an example benchmark output on my Fedora 17 on core i7:
>>
>> exp: ITERS:5e+08: TOTAL:11.6213s, MAX:102.573ns, MIN:16.316ns, 4.30245e+07 iter/s
>> pow: ITERS:2e+08: TOTAL:12.1205s, MAX:187.642ns, MIN:58.18ns, 1.65009e+07 iter/s
>> slowexp: ITERS:5e+06: TOTAL:8.81398s, MAX:3189.31ns, MIN:1726.46ns, 567281 iter/s
>> slowpow: ITERS:100000: TOTAL:8.48876s, MAX:88725.7ns, MIN:83907.3ns, 11780.3 iter/s
>>
>> Siddhesh
>>
>> 	* benchtests/Makefile: Add benchmarks for slowpow and slowexp.
>> 	(bench): Add slowexp and slowpow.
>> 	(exp-ITER): Increase iterations.
>> 	(pow-ITER): Likewise.
>> 	* benchtests/exp-inputs: Change input.
>> 	* benchtests/pow-inputs: Likewise.
>> 	* benchtests/slowexp-inputs: New file.
>> 	* benchtests/slowexp.c: New file.
>> 	* benchtests/slowpow-inputs: New file.
>> 	* benchtests/slowpow.c: New file.
>>
>> diff --git a/benchtests/Makefile b/benchtests/Makefile
>> index 74938b9..f301ed1 100644
>> --- a/benchtests/Makefile
>> +++ b/benchtests/Makefile
>> @@ -43,17 +43,33 @@
>>  #   See pow-inputs for an example.
>>  
>>  subdir := benchtests
>> -bench := exp pow
>> +bench := exp pow slowexp slowpow
>>  
>> -exp-ITER = 100000
>> +# exp function fast path
>> +exp-ITER = 5e8
>>  exp-ARGLIST = double
>>  exp-RET = double
>>  LDFLAGS-bench-exp = -lm
>>  
>> -pow-ITER = 100000
>> +# pow function fast path
>> +pow-ITER = 2e8
>>  pow-ARGLIST = double:double
>>  pow-RET = double
>>  LDFLAGS-bench-pow = -lm
>>  
>> +# exp function slowest path
>> +slowexp-ITER = 5e6
>> +slowexp-ARGLIST = double
>> +slowexp-RET = double
>> +slowexp-INCLUDE = slowexp.c
>> +LDFLAGS-bench-slowexp = -lm
>> +
>> +# pow function slowest path
>> +slowpow-ITER = 1e5
>> +slowpow-ARGLIST = double:double
>> +slowpow-RET = double
>> +slowpow-INCLUDE = slowpow.c
>> +LDFLAGS-bench-slowpow = -lm
>> +
>>  include ../Makeconfig
>>  include ../Rules
>> diff --git a/benchtests/exp-inputs b/benchtests/exp-inputs
>> index a2086ba..d81cc07 100644
>> --- a/benchtests/exp-inputs
>> +++ b/benchtests/exp-inputs
>> @@ -1 +1 @@
>> -708.00096423260981737257679924368858
>> +42
>> diff --git a/benchtests/pow-inputs b/benchtests/pow-inputs
>> index dbb1270..2f7cc03 100644
>> --- a/benchtests/pow-inputs
>> +++ b/benchtests/pow-inputs
>> @@ -1 +1 @@
>> -1.0000000000000020, 1.5
>> +42.0, 42.0
>> diff --git a/benchtests/slowexp-inputs b/benchtests/slowexp-inputs
>> new file mode 100644
>> index 0000000..a2086ba
>> --- /dev/null
>> +++ b/benchtests/slowexp-inputs
>> @@ -0,0 +1 @@
>> +708.00096423260981737257679924368858
>> diff --git a/benchtests/slowexp.c b/benchtests/slowexp.c
>> new file mode 100644
>> index 0000000..92ac5e9
>> --- /dev/null
>> +++ b/benchtests/slowexp.c
>> @@ -0,0 +1,19 @@
>> +/* Define slowexp.
>> +   Copyright (C) 2013 Free Software Foundation, Inc.
>> +   This file is part of the GNU C Library.
>> +
>> +   The GNU C Library is free software; you can redistribute it and/or
>> +   modify it under the terms of the GNU Lesser General Public
>> +   License as published by the Free Software Foundation; either
>> +   version 2.1 of the License, or (at your option) any later version.
>> +
>> +   The GNU C Library is distributed in the hope that it will be useful,
>> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> +   Lesser General Public License for more details.
>> +
>> +   You should have received a copy of the GNU Lesser General Public
>> +   License along with the GNU C Library; if not, see
>> +   <http://www.gnu.org/licenses/>.  */
>> +
>> +#define slowexp exp
>> diff --git a/benchtests/slowpow-inputs b/benchtests/slowpow-inputs
>> new file mode 100644
>> index 0000000..dbb1270
>> --- /dev/null
>> +++ b/benchtests/slowpow-inputs
>> @@ -0,0 +1 @@
>> +1.0000000000000020, 1.5
>> diff --git a/benchtests/slowpow.c b/benchtests/slowpow.c
>> new file mode 100644
>> index 0000000..08f436d
>> --- /dev/null
>> +++ b/benchtests/slowpow.c
>> @@ -0,0 +1,19 @@
>> +/* Define slowpow.
>> +   Copyright (C) 2013 Free Software Foundation, Inc.
>> +   This file is part of the GNU C Library.
>> +
>> +   The GNU C Library is free software; you can redistribute it and/or
>> +   modify it under the terms of the GNU Lesser General Public
>> +   License as published by the Free Software Foundation; either
>> +   version 2.1 of the License, or (at your option) any later version.
>> +
>> +   The GNU C Library is distributed in the hope that it will be useful,
>> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> +   Lesser General Public License for more details.
>> +
>> +   You should have received a copy of the GNU Lesser General Public
>> +   License along with the GNU C Library; if not, see
>> +   <http://www.gnu.org/licenses/>.  */
>> +
>> +#define slowpow pow
If it is any worth, looks good to me.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]