Actions
Misc #15014
closedthread.c: use rb_hrtime_scalar for high-resolution time operations
Status:
Closed
Assignee:
-
Description
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
I plan on using this for Timeout-in-VM [Feature #14859] and
auto-fiber [Feature #13618].
Files
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0