[ruby-core:76808] [Ruby trunk Feature#12497][Assigned] GMP version of divmod may be slower
From:
shyouhei@...
Date:
2016-08-10 03:11:01 UTC
List:
ruby-core #76808
Issue #12497 has been updated by Shyouhei Urabe.
Status changed from Open to Assigned
Assignee set to Akira Tanaka
----------------------------------------
Feature #12497: GMP version of divmod may be slower
https://bugs.ruby-lang.org/issues/12497#change-60033
* Author: Yusuke Endoh
* Status: Assigned
* Priority: Normal
* Assignee: Akira Tanaka
----------------------------------------
[The benchmark program `pidigits.rb`](https://benchmarksgame.alioth.debian.org/u64q/program.php?test=pidigits&lang=yarv&id=3) runs faster if USE_GMP is disabled for divmod.
~~~~
$ time ./miniruby.orig pidigits.rb 10000 > /dev/null
real 0m5.932s
user 0m5.740s
sys 0m0.188s
~~~~
~~~~
$ time ./miniruby.patched pidigits.rb 10000 > /dev/null
real 0m3.212s
user 0m3.056s
sys 0m0.152s
~~~~
~~~~
diff --git a/bignum.c b/bignum.c
index 767659d..33a172e 100644
--- a/bignum.c
+++ b/bignum.c
@@ -2813,12 +2813,6 @@ rb_big_divrem_gmp(VALUE x, VALUE y)
static void
bary_divmod_branch(BDIGIT *qds, size_t qn, BDIGIT *rds, size_t rn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
{
-#ifdef USE_GMP
- if (GMP_DIV_DIGITS < xn) {
- bary_divmod_gmp(qds, qn, rds, rn, xds, xn, yds, yn);
- return;
- }
-#endif
bary_divmod_normal(qds, qn, rds, rn, xds, xn, yds, yn);
}
~~~~
We can possibly tune performance.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>