[前][次][番号順一覧][スレッド一覧]

ruby-changes:40592

From: ko1 <ko1@a...>
Date: Thu, 19 Nov 2015 20:13:37 +0900 (JST)
Subject: [ruby-changes:40592] ko1:r52671 (trunk): * gc.c: trivial performance improvements.

ko1	2015-11-19 20:13:27 +0900 (Thu, 19 Nov 2015)

  New Revision: 52671

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

  Log:
    * gc.c: trivial performance improvements.
    
        name    modified
        vm1_gc_short_lived*                1.015
        vm1_gc_short_with_complex_long*    1.014
        vm1_gc_short_with_long*            1.000
        vm1_gc_short_with_symbol*          1.016
        vm1_gc_wb_ary*                     1.002
        vm1_gc_wb_ary_promoted*            0.996
        vm1_gc_wb_obj*                     1.045
        vm1_gc_wb_obj_promoted*            1.014
        vm3_gc                             1.021
    
    * gc.c (gc_writebarrier_generational): reorder parameters to optimize
      register passing function call.
    
    * gc.c (gc_writebarrier_incremental): ditto.
    
    * gc.c (rb_gc_writebarrier): remove LIKELY().
      LIKELY() seems to move related functions not better places.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52670)
+++ ChangeLog	(revision 52671)
@@ -1,3 +1,26 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Nov 19 20:08:59 2015  Koichi Sasada  <ko1@a...>
+
+	* gc.c: trivial performance improvements.
+
+	    name    modified
+	    vm1_gc_short_lived*                1.015
+	    vm1_gc_short_with_complex_long*    1.014
+	    vm1_gc_short_with_long*            1.000
+	    vm1_gc_short_with_symbol*          1.016
+	    vm1_gc_wb_ary*                     1.002
+	    vm1_gc_wb_ary_promoted*            0.996
+	    vm1_gc_wb_obj*                     1.045
+	    vm1_gc_wb_obj_promoted*            1.014
+	    vm3_gc                             1.021
+
+	* gc.c (gc_writebarrier_generational): reorder parameters to optimize
+	  register passing function call.
+
+	* gc.c (gc_writebarrier_incremental): ditto.
+
+	* gc.c (rb_gc_writebarrier): remove LIKELY().
+	  LIKELY() seems to move related functions not better places.
+
 Thu Nov 19 19:45:05 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* ruby.c (ruby_prog_init): [DOC] ARGV does not contain the name of
Index: gc.c
===================================================================
--- gc.c	(revision 52670)
+++ gc.c	(revision 52671)
@@ -5654,10 +5654,10 @@ rgengc_mark_and_rememberset_clear(rb_obj https://github.com/ruby/ruby/blob/trunk/gc.c#L5654
 
 /* RGENGC: APIs */
 
-NOINLINE(static void gc_writebarrier_generational(rb_objspace_t *objspace, VALUE a, VALUE b));
+NOINLINE(static void gc_writebarrier_generational(VALUE a, VALUE b, rb_objspace_t *objspace));
 
 static void
-gc_writebarrier_generational(rb_objspace_t *objspace, VALUE a, VALUE b)
+gc_writebarrier_generational(VALUE a, VALUE b, rb_objspace_t *objspace)
 {
     if (RGENGC_CHECK_MODE) {
 	if (!RVALUE_OLD_P(a)) rb_bug("gc_writebarrier_generational: %s is not an old object.", obj_info(a));
@@ -5700,10 +5700,10 @@ gc_mark_from(rb_objspace_t *objspace, VA https://github.com/ruby/ruby/blob/trunk/gc.c#L5700
     gc_grey(objspace, obj);
 }
 
-NOINLINE(static void gc_writebarrier_incremental(rb_objspace_t *objspace, VALUE a, VALUE b));
+NOINLINE(static void gc_writebarrier_incremental(VALUE a, VALUE b, rb_objspace_t *objspace));
 
 static void
-gc_writebarrier_incremental(rb_objspace_t *objspace, VALUE a, VALUE b)
+gc_writebarrier_incremental(VALUE a, VALUE b, rb_objspace_t *objspace)
 {
     gc_report(2, objspace, "gc_writebarrier_incremental: [LG] %s -> %s\n", obj_info(a), obj_info(b));
 
@@ -5731,7 +5731,7 @@ gc_writebarrier_incremental(rb_objspace_ https://github.com/ruby/ruby/blob/trunk/gc.c#L5731
     }
 }
 #else
-#define gc_writebarrier_incremental(objspace, a, b)
+#define gc_writebarrier_incremental(a, b, objspace)
 #endif
 
 void
@@ -5742,16 +5742,16 @@ rb_gc_writebarrier(VALUE a, VALUE b) https://github.com/ruby/ruby/blob/trunk/gc.c#L5742
     if (RGENGC_CHECK_MODE && SPECIAL_CONST_P(a)) rb_bug("rb_gc_writebarrier: a is special const");
     if (RGENGC_CHECK_MODE && SPECIAL_CONST_P(b)) rb_bug("rb_gc_writebarrier: b is special const");
 
-    if (LIKELY(!is_incremental_marking(objspace))) {
+    if (!is_incremental_marking(objspace)) {
 	if (!RVALUE_OLD_P(a) || RVALUE_OLD_P(b)) {
 	    return;
 	}
 	else {
-	    gc_writebarrier_generational(objspace, a, b);
+	    gc_writebarrier_generational(a, b, objspace);
 	}
     }
     else { /* slow path */
-	gc_writebarrier_incremental(objspace, a, b);
+	gc_writebarrier_incremental(a, b, objspace);
     }
 }
 

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

[前][次][番号順一覧][スレッド一覧]