bc: only check for ^C in bc_program_exec() main loop
authorDenys Vlasenko <vda.linux@googlemail.com>
Sun, 2 Dec 2018 18:43:34 +0000 (19:43 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 5 Dec 2018 14:43:35 +0000 (15:43 +0100)
commit71e1fc6b376e1fde2c3b0dbcf94c4261eed9c6c5
tree0a91702c3dc192b3dead09f39c7946562c952a36
parentdf51539ed0ceaa0556a509b25dafdec11437e645
bc: only check for ^C in bc_program_exec() main loop

Checking it in individual operations such as SQRT is not necessary
since they usually do not take very long to complete. We repeatedly return
to main loop.

TODO: re-add more fine-grained ^C checks - but only with examples where it is
actually needed. E.g. I suspect simplest ops like addition or compare won't need it.

function                                             old     new   delta
bc_program_index                                      66      64      -2
bc_num_s                                             258     246     -12
bc_num_cmp                                           294     275     -19
bc_num_compare                                        84      59     -25
bc_num_subArrays                                      74      47     -27
bc_num_a                                             474     445     -29
bc_program_exec                                     4530    4500     -30
bc_num_p                                             518     472     -46
bc_num_d                                             604     558     -46
bc_num_k                                            1005     957     -48
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/10 up/down: 0/-284)          Total: -284 bytes
   text    data     bss     dec     hex filename
 988601     485    7296  996382   f341e busybox_old
 988317     485    7296  996098   f3302 busybox_unstripped

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