[ruby-cvs:71625] normal:r64533 (trunk): thread.c: use rb_hrtime_t scalar for high-resolution time operations

normal at ruby-lang.org normal at ruby-lang.org
Sat Aug 25 15:58:35 JST 2018


normal	2018-08-25 15:58:35 +0900 (Sat, 25 Aug 2018)

  New Revision: 64533

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

  Log:
    thread.c: use rb_hrtime_t scalar for high-resolution time operations
    
    Relying on "struct timespec" was too annoying API-wise and
    used more stack space.  "double" was a bit wacky w.r.t rounding
    in the past, so now we'll switch to using a 64-bit type.
    
    Unsigned 64-bit integer is able to give us over nearly 585
    years of range with nanoseconds.  This range is good enough
    for the Linux kernel internal time representation, so it
    ought to be good enough for us.
    
    This reduces the stack usage of functions while GVL is held
    (and thus subject to marking) on x86-64 Linux (with ppoll):
    
    rb_wait_for_single_fd    120 => 104
    do_select                120 => 88
    
    [ruby-core:88582] [Misc #15014]

  Added files:
    trunk/hrtime.h
  Modified files:
    trunk/common.mk
    trunk/thread.c
    trunk/thread_pthread.c
    trunk/thread_sync.c
    trunk/thread_win32.c


More information about the ruby-cvs mailing list