[#53944] [ruby-trunk - Bug #8210][Open] Multibyte character interfering with end-line character within a regex — "sawa (Tsuyoshi Sawada)" <sawadatsuyoshi@...>

14 messages 2013/04/03

[#53974] [ruby-trunk - Feature #8215][Open] Support accessing Fiber-locals and backtraces for a Fiber — "halorgium (Tim Carey-Smith)" <ruby-lang-bugs@...>

14 messages 2013/04/03

[#54095] [ruby-trunk - Feature #8237][Open] Logical method chaining via inferred receiver — "wardrop (Tom Wardrop)" <tom@...>

34 messages 2013/04/08

[#54138] [ruby-trunk - Bug #8241][Open] If uri host-part has underscore ( '_' ), 'URI#parse' raise 'URI::InvalidURIError' — "neocoin (Sangmin Ryu)" <neocoin@...>

9 messages 2013/04/09

[#54185] [CommonRuby - Feature #8257][Open] Exception#cause to carry originating exception along with new one — "headius (Charles Nutter)" <headius@...>

43 messages 2013/04/11

[#54196] Encouraging use of CommonRuby — Charles Oliver Nutter <headius@...>

I think we need to do more to encourage the use of the CommonRuby

20 messages 2013/04/11
[#54200] Re: Encouraging use of CommonRuby — Marc-Andre Lafortune <ruby-core-mailing-list@...> 2013/04/11

Hi,

[#54211] Re: Encouraging use of CommonRuby — "NARUSE, Yui" <naruse@...> 2013/04/12

As far as I understand, what is CommonRuby and the process over CommonRuby

[#54207] [CommonRuby - Feature #8258][Open] Dir#escape_glob — "steveklabnik (Steve Klabnik)" <steve@...>

15 messages 2013/04/12

[#54218] [CommonRuby - Feature #8259][Open] Atomic attributes accessors — "funny_falcon (Yura Sokolov)" <funny.falcon@...>

43 messages 2013/04/12

[#54288] [CommonRuby - Feature #8271][Open] Proposal for moving to a more visible, formal process for feature requests — "headius (Charles Nutter)" <headius@...>

15 messages 2013/04/15

[#54333] Requesting Commit Access — Aman Gupta <ruby@...1.net>

Hello ruby-core,

16 messages 2013/04/16

[#54473] [Backport 200 - Backport #8299][Open] Minor error in float parsing — "bobjalex (Bob Alexander)" <bobjalex@...>

27 messages 2013/04/19

[#54532] [ruby-trunk - Bug #8315][Open] mkmf does not include include paths from pkg_config anymore — "Hanmac (Hans Mackowiak)" <hanmac@...>

11 messages 2013/04/23

[#54621] [ruby-trunk - Feature #8339][Open] Introducing Geneartional Garbage Collection for CRuby/MRI — "ko1 (Koichi Sasada)" <redmine@...>

43 messages 2013/04/27
[#54643] [ruby-trunk - Feature #8339] Introducing Geneartional Garbage Collection for CRuby/MRI — "authorNari (Narihiro Nakamura)" <authorNari@...> 2013/04/28

[#54649] Re: [ruby-trunk - Feature #8339] Introducing Geneartional Garbage Collection for CRuby/MRI — SASADA Koichi <ko1@...> 2013/04/28

(2013/04/28 9:23), authorNari (Narihiro Nakamura) wrote:

[#54657] Re: [ruby-trunk - Feature #8339][Open] Introducing Geneartional Garbage Collection for CRuby/MRI — Magnus Holm <judofyr@...> 2013/04/28

On Sat, Apr 27, 2013 at 8:19 PM, ko1 (Koichi Sasada)

[#54665] [ruby-trunk - Bug #8344][Open] Status of Psych and Syck — "Eregon (Benoit Daloze)" <redmine@...>

18 messages 2013/04/28

[ruby-core:54506] Fwd: [ruby-changes:28358] charliesome:r40410 (trunk): * insns.def (opt_mod): Use % operator if both operands are positive for

From: SASADA Koichi <ko1@...>
Date: 2013-04-22 16:18:30 UTC
List: ruby-core #54506
Interesting modify.

BTW, Please add a measurement result (link to describe page) if you
mention about "performance improvement". (or add microbenchmark under
the benchmark/ directory).


-------- Original Message --------
Subject: [ruby-changes:28358] charliesome:r40410 (trunk): * insns.def
(opt_mod): Use % operator if both operands are positive for
Date: Mon, 22 Apr 2013 22:57:33 +0900 (JST)
From: charliesome <ko1@atdot.net>
Reply-To: ruby-changes@quickml.atdot.net
To: ruby-changes@quickml.atdot.net

charliesome	2013-04-22 22:57:21 +0900 (Mon, 22 Apr 2013)

  New Revision: 40410

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40410

  Log:
    * insns.def (opt_mod): Use % operator if both operands are positive for
      a significant performance improvement. Thanks to @samsaffron.

  Modified files:
    trunk/ChangeLog
    trunk/insns.def

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40409)
+++ ChangeLog	(revision 40410)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Apr 22 22:54:00 2013  Charlie Somerville
<charlie@charliesomerville.com>
+
+	* insns.def (opt_mod): Use % operator if both operands are positive for
+	  a significant performance improvement. Thanks to @samsaffron.
+
 Mon Apr 22 17:09:37 2013  Nobuyoshi Nakada  <nobu@ruby-lang.org>

 	* marshal.c (r_object0): copy all instance variables not only generic
Index: insns.def
===================================================================
--- insns.def	(revision 40409)
+++ insns.def	(revision 40410)
@@ -1524,13 +1524,15 @@ opt_mod
https://github.com/ruby/ruby/blob/trunk/insns.def#L1524
 {
     if (FIXNUM_2_P(recv, obj) &&
 	BASIC_OP_UNREDEFINED_P(BOP_MOD, FIXNUM_REDEFINED_OP_FLAG )) {
-	long x, y, mod;
+	long x, y;

 	x = FIX2LONG(recv);
 	y = FIX2LONG(obj);
-	{
+	if (x > 0 && y > 0) {
+	    val = LONG2FIX(x % y);
+	} else {
 	    /* copied from numeric.c#fixdivmod */
-	    long div;
+	    long div, mod;

 	    if (y == 0)
 		rb_num_zerodiv();
@@ -1551,8 +1553,8 @@ opt_mod
https://github.com/ruby/ruby/blob/trunk/insns.def#L1553
 		mod += y;
 		div -= 1;
 	    }
+	    val = LONG2FIX(mod);
 	}
-	val = LONG2FIX(mod);
     }
     else if (FLONUM_2_P(recv, obj) &&
 	     BASIC_OP_UNREDEFINED_P(BOP_MOD, FLOAT_REDEFINED_OP_FLAG)) {

--
ML: ruby-changes@quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml/


Attachments (1)

添付メッセージ部 (0 Bytes, text/plain)

  

In This Thread

Prev Next