Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!rochester!rutgers!att!mtunb!dmt From: dmt@mtunb.ATT.COM (Dave Tutelman) Newsgroups: comp.sys.ibm.pc Subject: Re: Screen-writing speed & snow elimination Summary: 2 pages? Probably not faster. Message-ID: <1436@mtunb.ATT.COM> Date: 14 Mar 89 21:00:53 GMT References: <1433@mtunb.ATT.COM> <3562@sdsu.UUCP> <53527@yale-celray.yale.UUCP> Reply-To: dmt@mtunb.UUCP (Dave Tutelman) Organization: AT&T Bell Labs - Lincroft, NJ Lines: 71 >In article <3562@sdsu.UUCP> flong@sdsu.UCSD.EDU (Fred J. E. Long) writes: >| Please correct me if I am wrong, but can't you do this for fast writes: >| >| 1) Write the characters to page 2 >| 2) Switch to page 2 for viewing >| 3) Write the characters to page 1 >| 4) Go back to page 1 for viewing In article <53527@yale-celray.yale.UUCP> spolsky-joel@CS.YALE.EDU (Joel Spolsky) responds: >The IBM MDA (monochrome display adapter) only has one page. So, unless >you want to write two sets of i/o routines, no, you can't. Actually, the MDA doesn't have a snow problem at all, so you don't need to go to this trouble. Fortunate indeed, because Joel is right that it has only one page (though the Hercules monochrome has several). Joel is also right that you'll need multiple routines: one with the page switching and one without. However, let's see if there is something to be gained from page-switching. The most speed you can hope to gain is the difference between raw screen writes and those protected by waiting for retrace. The price of this is the need to keep two copies of the screen up-to-date. (I assume you want to make incremental updates to an existing screen, not just repaint the whole screen each time you change it. That means that the "off-screen" page must be kept identical to the "on-screen" one.) Thus, to make the two-page technique pay off, you've got to be able to do raw screen writes at least twice as fast as the retrace-protected writes, because you've got to do twice as many of them. My measurements show precious few cases where the raw writes were more than twice as fast as the retrace-protected writes. In the majority of machines (especially the slower ones, where algorithm performance buys the most), the speed gain is less than x1.5. In those cases, keeping two pages is a net loss. So here are the places where keeping two screens might be worthwhile: - The cases where the speedup is worth it. From my data, that includes cases like a PC6300 PLUS (286 box) or a PC6386 (386 box) with a display that NEEDS snow removal. - Painting a brand new screen for the first time. Some programs have places where the entire screen context changes. Page switching is a way of making that happen insantly and snow-free. - Those programs where there is "dead time" after a screen write, that can be used for updating the off-screen page. Many places in interactive programs have this characteristic. However, it's got to be more than one or two characters to pay off; even the BIOS has no apparent performance problem where you write less than a line. - Those programs where the APPEARANCE of speed is more important than real speed. With page switching, the update is done invisibly and then "snaps" to the screen; you don't watch the screen being painted. (I've always found this sort of operation more annoying than watching the screen go; if it were actually slower, it'd be intolerable. However, no accounting for taste :-) In summary, good idea Fred, and it works. But its advantages are limited to special cases. If I wanted to write ONE way of doing it for all my console programs, I'd use retrace-protection. +---------------------------------------------------------------+ | Dave Tutelman | | Physical - AT&T Bell Labs - Lincroft, NJ | | Logical - ...att!mtunb!dmt | | Audible - (201) 576 2442 | +---------------------------------------------------------------+