lkml.org 
[lkml]   [1996]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectSpeeding up screen output for dialog
I've been wondering why some dialog-based applications (e.g. menuconfig) take
so long even on a P90 to draw the screen. So I made some investigations with
strace. I found that ncurses writes to the screen in rather large blocks of
bytes, but these get broken up in write_chan() in n_tty.c into single byte
writes to the console, which is inefficient (I assume that setting the cursor
after each write is the most time-consuming part). So I came up with a hack:
Instead of calling opost() for each byte, I wrote a new function opost_block()
that examines the buffer and returns the number of bytes that can be directly
written. These are then passed to con_write() instead of put_char().

I've attached a patch. Comments are welcome. I didn't try very hard to make
opost_block() return the maximum number of characters that can be written,
there may be some room for improvement. Even so, there is a substantial speed
increase for menuconfig (I made the Makefile link lxdialog statically for good
measure). It's almost enjoyable now :)

Bernd

begin 644 fast_opost.diff
M9&EF9B`M=7)D(&QI;G5X+6]R:6<O9')I=F5R<R]C:&%R+VY?='1Y+F,@;&EN
M=7@O9')I=F5R<R]C:&%R+VY?='1Y+F,*+2TM(&QI;G5X+6]R:6<O9')I=F5R
M<R]C:&%R+VY?='1Y+F,)5V5D($IU;"`R-"`P.3HT.3HU,R`Q.3DV"BLK*R!L
M:6YU>"]D<FEV97)S+V-H87(O;E]T='DN8PE3=6X@4V5P("`Q(#$V.C0R.C$Y
M(#$Y.38*0$`@+3$U-2PV("LQ-34L,S@@0$`*(`ER971U<FX@,#L*('T*(`HK
M<W1A=&EC(&EN="!O<&]S=%]B;&]C:RAS=')U8W0@='1Y7W-T<G5C="`J('1T
M>2P**PD)("`@("`@(&-O;G-T('5N<VEG;F5D(&-H87(@*B!B=68L('5N<VEG
M;F5D(&EN="!N<BD**WL**PEI;G0@<W!A8V4["BL):6YT(&D["BL**PES<&%C
M92`]('1T>2T^9')I=F5R+G=R:71E7W)O;VTH='1Y*3L**PEI9B`H(7-P86-E
M*0HK"0ER971U<FX@+3$["BL):68@*&YR(#X@<W!A8V4I"BL)"6Y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Ocean and TransIP|Read the blog|Advertise on this site