The Win32 port of PDCurses has always had a performance problem under 
Windows 9x. The cause was never quite clear. (I used to think the keyboard 
code was at fault; but no.)

Yesterday I discovered that I'd fixed it, quite by accident, sometime 
after 2.8. I was running newdemo.exe; the test where it randomly fills the 
box with 'a', then 'b', is the closest thing to a speed benchmark for 
PDCurses. Under 9x, it used to just trickle along, but now it fills up 
instantly. So I put a clock() counter around the loop, and tested with 
both CVS and 2.8 libraries. The results were astonishing -- under Windows 
98, it went from about 6500 to about 100. Windows 95 was even more 
dramatic: from around 9000 to about 14! (Note: These results were under 
Virtual PC.) Even XP had improved, but only from about 230 to about 200.

Eventually I traced the fix to a change in doupdate(): it no longer 
updates the cursor position if the cursor is turned off ("curs_set(0)"). 
(So, if you leave the cursor on, you still won't see any performance gain; 
sorry.) It seems the Windows console function SetConsoleCursorPosition() 
is insanely slow. The actual output and input functions are fine -- in 
fact, AFAICT, they're faster in 9x than in XP.

BTW, BIOS mode in DOS is also a lot faster now, but in that case I knew 
what I was doing. :-) Both changes (among others) are available via 
anonymous CVS.

-- 
William McBrine <[EMAIL PROTECTED]>

Reply via email to