[ruby-core:76054] [Ruby trunk Feature#12497] GMP version of divmod may be slower
From:
mame@...
Date:
2016-06-16 17:04:12 UTC
List:
ruby-core #76054
Issue #12497 has been reported by Yusuke Endoh.
----------------------------------------
Feature #12497: GMP version of divmod may be slower
https://bugs.ruby-lang.org/issues/12497
* Author: Yusuke Endoh
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
[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>