From 3fcf1bf57d99482e9882fc8d5b3348da799c41c5 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 22 Jan 2014 20:34:47 +0000 Subject: [PATCH] method.h: save 8 bytes in rb_method_definition_t on x86-64 Rearranging the struct to have two 32-bit values next to each other allows the struct to be one word smaller on 64-bit. This lowers overall memory use as we have many methods out-of-the box: $ /usr/bin/time ./ruby -e exit 0.06user 0.00system 0:00.07elapsed 98%CPU (0avgtext+0avgdata 7420maxresident)k 0inputs+0outputs (0major+1930minor)pagefaults 0swaps $ /usr/bin/time ./ruby -e exit 0.06user 0.00system 0:00.07elapsed 98%CPU (0avgtext+0avgdata 7372maxresident)k 0inputs+0outputs (0major+1918minor)pagefaults 0swaps --- method.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/method.h b/method.h index c93e4c3..556d286 100644 --- a/method.h +++ b/method.h @@ -77,6 +77,7 @@ typedef struct rb_iseq_struct rb_iseq_t; typedef struct rb_method_definition_struct { rb_method_type_t type; /* method type */ + int alias_count; ID original_id; union { rb_iseq_t * const iseq; /* should be mark */ @@ -91,7 +92,6 @@ typedef struct rb_method_definition_struct { } optimize_type; struct rb_method_entry_struct *orig_me; } body; - int alias_count; } rb_method_definition_t; typedef struct rb_method_entry_struct {