[ruby-cvs:64955] shyouhei:r57789 (trunk): optimize FIXABLE macro

shyouhei at ruby-lang.org shyouhei at ruby-lang.org
Mon Mar 6 20:14:05 JST 2017


shyouhei	2017-03-06 20:14:05 +0900 (Mon, 06 Mar 2017)

  New Revision: 57789

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

  Log:
    optimize FIXABLE macro
    
    Looking at the source code, FIXABLE tends to be just before LOING2FIX
    to check applicability of that operation.  Why not try computing first
    then check for overflow, which should be optimial.
    
    I also tried the same thing for unsigned types but resulted in slower
    execution.  It seems RB_POSFIXABLE() is fast enough on modern CPUs.

  Modified files:
    trunk/bignum.c
    trunk/compile.c
    trunk/include/ruby/ruby.h
    trunk/insns.def
    trunk/internal.h
    trunk/numeric.c
    trunk/object.c
    trunk/sprintf.c


More information about the ruby-cvs mailing list