]> git.ozlabs.org Git - petitboot/commit
ui/ncurses: Reduce unnecessary calls to redrawwin
authorSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Wed, 4 Feb 2015 01:02:23 +0000 (12:02 +1100)
committerSamuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Mon, 16 Feb 2015 03:25:23 +0000 (14:25 +1100)
commit91143069d1a40cefd997522d85cb2d8adf1681f7
treebda3d7e66f2c6c927309987d693585965d43bbde
parent7b67c329067af30ffd2a1dd44cd938a7ee55af56
ui/ncurses: Reduce unnecessary calls to redrawwin

All current *_post() methods in ui/ncurses call redrawwin() and
wrefresh() together. wrefresh() updates any lines on the screen that
have been marked as changed or invalid. However redrawwin() marks the
entire screen as invalid unconditionally. We can reduce the amount of
data written to the screen by avoiding calls to redrawwin().

Screen transitions are the primary use case of redrawwin(), where the
whole screen must be invalidated to avoid stale data remaining on
screen. All other 'in-screen' updates such as changes to widgets or
changing focus do not require a call to redrawwin(). The most noticeable
performance improvement is in nc-menu, which makes an unnecssary call to
redrawwin() after every addition to the boot option menu.

eg. The number of bytes written to STDOUT in the main menu:
# Boot options | Before | After
--------------------------------
8 | 5488   | 1149
133 | 422454 | 4652

Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
ui/ncurses/nc-add-url.c
ui/ncurses/nc-boot-editor.c
ui/ncurses/nc-config.c
ui/ncurses/nc-lang.c
ui/ncurses/nc-menu.c