luislavena/rb-readline — pull request #72 by shirosaki (2012-09-03 05:25:37+00:00)
Title: Improve performance for _rl_adjust_point

_rl_adjust_point() takes a long time when inserting text. If point
argument is large value, performance is poor. In the case, counting
byte size from tail of the string will improve performance.
And I added some small improvements.

Here is benchmark with
tcs-ruby 1.9.3p231 (2012-05-25, TCS patched 2012-05-27) [i386-mingw32]
on Windows XP.

### examples/bench_rl_adjust_point.rb:

### without patch

```
user system total real
0.156000 0.000000 0.156000 ( 0.156250)
0.188000 0.000000 0.188000 ( 0.187500)
0.156000 0.000000 0.156000 ( 0.156250)
0.031000 0.000000 0.031000 ( 0.031250)
0.157000 0.000000 0.157000 ( 0.156250)
1.578000 0.000000 1.578000 ( 1.593750)
```

### with patch

```
user system total real
0.110000 0.000000 0.110000 ( 0.109375)
0.125000 0.000000 0.125000 ( 0.125000)
0.109000 0.000000 0.109000 ( 0.109375)
0.047000 0.000000 0.047000 ( 0.046875)
0.109000 0.000000 0.109000 ( 0.109375)
0.157000 0.000000 0.157000 ( 0.156250)
```