[ruby-cvs:56580] normal:r49430 (trunk): thread.c: micro-optimize thread create/join

normal at ruby-lang.org normal at ruby-lang.org
Thu Jan 29 02:06:41 JST 2015

normal	2015-01-29 02:06:40 +0900 (Thu, 29 Jan 2015)

  New Revision: 49430


    thread.c: micro-optimize thread create/join
    * thread.c (struct join_arg): restructure and make smaller
      (thread_join_sleep): avoid timeofday() call if forever
      (thread_join): pass join_arg.delay directly
      (rb_thread_inspect_msg): remove, inline into rb_thread_inspect
      (rb_thread_inspect): reduce branching and string creation
    * thread_pthread.c (native_set_thread_name): create string directly
      to avoid reparsing. [Misc #10723]
    This reduces time in benchmark/bm_vm_thread_create_join.rb by
    a few percent.
    Minor improvements only:
    target 0: 2.1.5 (ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux])
    target 1: trunk (ruby 2.3.0dev (2015-01-16 trunk 49282) [x86_64-linux])
    target 2: built (ruby 2.3.0dev (2015-01-16 trunk 49282) [x86_64-linux])
    benchmark results:
    minimum results in each 3 measurements.
    Execution time (sec)
    name                    2.1.5   trunk   built
    vm_thread_create_join   1.049   1.242   1.138
    Speedup ratio: compare with the result of `2.1.5' (greater is better)
    name                    trunk   built
    vm_thread_create_join   0.845   0.923

  Modified files:

More information about the ruby-cvs mailing list