[ruby-core:60794] [RFC] rearrange+pack vtm and time_object structs

From: Eric Wong <normalperson@...>
Date: 2014-02-16 23:05:07 UTC
List: ruby-core #60794
Extracted from addendum on top of Feature #9362 (cache-aligned objects).
Since that is rejected, Time object can no longer be natively embedded,
but that is fine.  We can pack struct time_object, since Time.now is
called frequently for some users (logging) and end up allocating a lot
of short-lived Time objects as a result.  This reduces memory pressure
and leads to a small speedup:

Before:
$ /usr/bin/time ./ruby -e '5000000.times { Time.now }'
2.56user 0.01system 0:02.57elapsed 100%CPU (0avgtext+0avgdata 8864maxresident)k
0inputs+0outputs (0major+2299minor)pagefaults 0swaps

After:
$ /usr/bin/time ./ruby -e '5000000.times { Time.now }'
2.25user 0.00system 0:02.26elapsed 100%CPU (0avgtext+0avgdata 8180maxresident)k
0inputs+0outputs (0major+2130minor)pagefaults 0swaps

	* configure.in: use -Wno-packed-bitfield-compat for GCC 4.4+
	  use __attribute__((packed)) if available
	* timev.h: shrink and pack struct vtm
	* time.c: pack struct time_object and adjust/introduce helpers

patch: http://bogomips.org/ruby.git/patch?id=6081635e7

The following changes since commit 5422532699285e81a7a07b1b49dc92b54530f987:

  * 2014-02-17 (2014-02-16 17:14:15 +0000)

are available in the git repository at:

  git://80x24.org/ruby.git time

for you to fetch changes up to 6081635e700c681b77b7ee0d0f876b204fc0cb50:

  rearrange+pack vtm and time_object structs (2014-02-16 21:47:48 +0000)

----------------------------------------------------------------
Eric Wong (1):
      rearrange+pack vtm and time_object structs

 configure.in | 10 ++++++++
 time.c       | 75 +++++++++++++++++++++++++++++++++++++-----------------------
 timev.h      | 18 +++++++--------
 3 files changed, 66 insertions(+), 37 deletions(-)

In This Thread

Prev Next