hush: speed optimizations
authorDenys Vlasenko <vda.linux@googlemail.com>
Thu, 29 Sep 2016 17:50:55 +0000 (19:50 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Thu, 29 Sep 2016 17:50:55 +0000 (19:50 +0200)
commit46e6498b2afccd093d03697313e0d0c2f6e4d38d
tree7527d9c60c2e58da81242bdaa185ff894f26a496
parent657086a3dc573649165a5271473fa1bcf58dc9ed
hush: speed optimizations

Make o_addchr() faster: do not call o_grow_by() each time.
Create i_getch_and_eat_bkslash_nl(), use it instead of peek+getch pair.

function                                             old     new   delta
o_addchr                                              42      54     +12
parse_dollar                                         761     771     +10
o_grow_by                                             48      37     -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 24/-11)             Total: 11 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/hush.c