[ruby-cvs:59501] ko1:r52350 (trunk): * encoding.c (rb_enc_check_str): add for performance.

ko1 at ruby-lang.org ko1 at ruby-lang.org
Thu Oct 29 18:10:33 JST 2015


ko1	2015-10-29 18:10:32 +0900 (Thu, 29 Oct 2015)

  New Revision: 52350

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

  Log:
    * encoding.c (rb_enc_check_str): add for performance.
      This function only accept T_STRING (and T_REGEXP).
    
      This patch improves performance of a tiny_segmenter benchmark
      (num=2) 2.54sec -> 2.42sec on my machine.
      https://github.com/chezou/TinySegmenter.jl/blob/master/benchmark/benchmark.rb
    
    * encoding.c: add ENC_DEBUG and ENC_ASSERT() macros.
    
    * internal.h: add a decl. of rb_enc_check_str().
    
    * string.c (rb_str_plus): use rb_enc_check_str().
    
    * string.c (rb_str_subpat_set): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/encoding.c
    trunk/internal.h
    trunk/string.c


More information about the ruby-cvs mailing list