ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:60794] [RFC] rearrange+pack vtm and time_object structs
@ 2014-02-16 23:05 Eric Wong
  2014-02-19 23:23 ` [ruby-core:60878] " Eric Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Wong @ 2014-02-16 23:05 UTC (permalink / raw
  To: ruby-core

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(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:60878] Re: [RFC] rearrange+pack vtm and time_object structs
  2014-02-16 23:05 [ruby-core:60794] [RFC] rearrange+pack vtm and time_object structs Eric Wong
@ 2014-02-19 23:23 ` Eric Wong
  2014-02-20  1:56   ` [ruby-core:60881] " Urabe Shyouhei
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Wong @ 2014-02-19 23:23 UTC (permalink / raw
  To: ruby-core

Eric Wong <normalperson@yhbt.net> wrote:
> 	* 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

Btw, I'll commit this in a few days unless there are objections.
I've tested this on old gcc 4.2.1 and clang 3.3 on FreeBSD 9.2, too.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:60881] Re: [RFC] rearrange+pack vtm and time_object structs
  2014-02-19 23:23 ` [ruby-core:60878] " Eric Wong
@ 2014-02-20  1:56   ` Urabe Shyouhei
  2014-02-20  2:44     ` [ruby-core:60883] " Eric Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Urabe Shyouhei @ 2014-02-20  1:56 UTC (permalink / raw
  To: ruby-core

On 02/20/2014 08:23 AM, Eric Wong wrote:
> Eric Wong <normalperson@yhbt.net> wrote:
>> 	* 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
> 
> Btw, I'll commit this in a few days unless there are objections.
> I've tested this on old gcc 4.2.1 and clang 3.3 on FreeBSD 9.2, too.

I didn't seriously check if those second arguments to obj2ubits() are sane,
but otherwise the patch seems OK.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:60883] Re: [RFC] rearrange+pack vtm and time_object structs
  2014-02-20  1:56   ` [ruby-core:60881] " Urabe Shyouhei
@ 2014-02-20  2:44     ` Eric Wong
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2014-02-20  2:44 UTC (permalink / raw
  To: Ruby developers

Urabe Shyouhei <shyouhei@ruby-lang.org> wrote:
> I didn't seriously check if those second arguments to obj2ubits() are sane,
> but otherwise the patch seems OK.

Thanks for taking a look.  I wanted to make obj2ubits more DRY, but
didn't want to use macros to inside struct definitions.  Things won't
change frequently, but maybe porting to alternative/alien calendar
systems will be harder.

Now I worry aliens will abduct me and force me to port ruby for their
solar system :x

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-02-20  2:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-16 23:05 [ruby-core:60794] [RFC] rearrange+pack vtm and time_object structs Eric Wong
2014-02-19 23:23 ` [ruby-core:60878] " Eric Wong
2014-02-20  1:56   ` [ruby-core:60881] " Urabe Shyouhei
2014-02-20  2:44     ` [ruby-core:60883] " Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).