]> git.wincent.com - wikitext.git/commit
Replace many rb_str_append calls with rb_str_cat
authorWincent Colaiuta <win@wincent.com>
Tue, 5 Feb 2008 10:56:26 +0000 (11:56 +0100)
committerWincent Colaiuta <win@wincent.com>
Tue, 5 Feb 2008 10:56:26 +0000 (11:56 +0100)
commite116b3fa4eafefb3fd0ba31b630a322be07bd341
tree55973770b84e530064c3d20200c877f21818c483
parent767f54b6b4ca6af72e7861f7b73ce1e6765c1195
Replace many rb_str_append calls with rb_str_cat

I suspected that rb_str_cat would be faster than rb_str_append because
it avoids an unnecessary object instantiation. This commit changes all
constant strings to use rb_str_cat, shaving about 12% off of the parse
time.

Before:

  short slab of ASCII text    2.870000   0.000000   2.870000 (  2.929794)
  short slab of UTF-8 text    5.390000   0.010000   5.400000 (  5.399399)

After:

  short slab of ASCII text    2.380000   0.010000   2.390000 (  2.461861)
  short slab of UTF-8 text    4.860000   0.000000   4.860000 (  5.016289)

Signed-off-by: Wincent Colaiuta <win@wincent.com>
benchmarks/NOTES.txt
ext/parser.c