Re: Speeding up screen output for dialog

Andreas Koppenhoefer (koppenas@koppenas.dialup.informatik.uni-stuttgart.de)
09 Sep 1996 17:21:55 +0200


-----BEGIN PGP SIGNED MESSAGE-----

>>>>> "BS" == Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> writes:
In article <Pine.SOL.3.90.960902095019.269B-100000@clouseau.informatik.rwth-aachen.de> Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> writes:

BS> I've been wondering why some dialog-based applications
BS> (e.g. menuconfig) take so long even on a P90 to draw the screen. So I
BS> made some investigations with strace. I found that ncurses writes to
BS> the screen in rather large blocks of bytes, but these get broken up in
BS> write_chan() in n_tty.c into single byte writes to the console, which
BS> is inefficient (I assume that setting the cursor after each write is
BS> the most time-consuming part). So I came up with a hack: Instead of
BS> calling opost() for each byte, I wrote a new function opost_block()
BS> that examines the buffer and returns the number of bytes that can be
BS> directly written. These are then passed to con_write() instead of
BS> put_char().
BS>
BS> I've attached a patch. Comments are welcome. I didn't try very hard to
BS> make opost_block() return the maximum number of characters that can be
BS> written, there may be some room for improvement. Even so, there is a
BS> substantial speed increase for menuconfig (I made the Makefile link
BS> lxdialog statically for good measure). It's almost enjoyable now :)
BS> [...patch removed...]

I've tried your patch with Linux/SPARC 2.0.18 running on a
SparcStation 2 with very slow bwtwo frame buffer. Previously while
editing under emacs I saw a delays of about 0.5 second when using ctrl-v
(next-page). Now it displays a new page immediately without any
noticeable delay!

That's great! Thank you for that patch!

- - Andreas

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2i
Comment: Processed by Mailcrypt 3.3, an Emacs/PGP interface

iQBVAwUBMjQ1/EVdjNvyndGpAQFhpgIAxTl2ZjZrGdwd24Ur1cWomiYcFLMWzeNd
+TmhkK9pVBOHhTva19snjcCdkkB5j5/FSTCjCJ28gjSXgyGCf06DNA==
=Vnt+
-----END PGP SIGNATURE-----

-- 
Andreas Koppenhoefer, Student der Universitaet Stuttgart, BR Deutschland
Franz-Schubert-Str. 2, 97616 Bad Neustadt; Phone +49 9771 7943, Fax/Data 7947
<akoppenhoefer@schweinfurt.netsurf.de>,<koppenas@informatik.uni-stuttgart.de>
<Andreas.Koppenhoefer@studbox.uni-stuttgart.de>; PGP-Key available at
URL <http://www.informatik.uni-stuttgart.de/menschen/ako/impressum.html>