hush: remove code to track PS1/2 values dynamically - it's too much work
authorDenys Vlasenko <vda.linux@googlemail.com>
Thu, 16 May 2019 13:39:19 +0000 (15:39 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Thu, 16 May 2019 13:39:19 +0000 (15:39 +0200)
commit4ebcdf7396b8e19ddf4e8b12a84b186fcbccabb8
tree80503d42301ee7ff16368a4a2f94e2b9b165564c
parenta51eec0b5aaee3835a54ca35c65e3cfc87004b97
hush: remove code to track PS1/2 values dynamically - it's too much work

Assignments / exports / unsets of variables are far more frequent than
prompt printing, and if we show prompt, we are likely to be limited by
user typing speed - do not optimize for that scenario.
Just re-query $PS1 / $PS2 values when need to show the prompt.

function                                             old     new   delta
fgetc_interactive                                    236     259     +23
set_vars_and_save_old                                150     147      -3
pseudo_exec_argv                                     597     594      -3
hush_main                                           1110    1105      -5
enter_var_nest_level                                  38      32      -6
builtin_local                                         56      50      -6
run_pipe                                            1857    1834     -23
leave_var_nest_level                                 127      98     -29
handle_changed_special_names                         111      79     -32
cmdedit_update_prompt                                 57       -     -57
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/8 up/down: 23/-164)          Total: -141 bytes

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