lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev connect_time patch


From: Leonid Pauzner
Subject: Re: lynx-dev connect_time patch
Date: Mon, 12 May 2003 14:10:47 +0400 (MSD)

Subj, see below.

28-Apr-2003 17:23 Thomas Dickey wrote:
> On Mon, Apr 28, 2003 at 09:27:22PM +0200, Gisle Vanem wrote:
>> "Leonid Pauzner" <address@hidden> said:
>>
>> > 4-Apr-2003 13:56 Gisle Vanem wrote:
>> >
>> > > Patch in lyutils.c: undef "select" in case Lynx is compiled with
>> > > curses (and not S-Lang). Watt-32's select_s cannot be used on a
>> > > stdin handle, so one must undef it and use djgpp's select().
>> >
>> > BTW, with this only patch, DJGPP compiled lynx lose nearly 50% performance,
>> > tested on huge local file. Native DJGPP select() seems too inefficient.
>>
>> That's because Lynx is inefficient in testing stdin for a keypress.
>> It calls select() on the full FD_SETSIZE (255) fds. djgpp's select() does
>> loop over all fd's even only fd 0 is set in readfds (as it should do).

> that's true - I've not gotten around to changing it before, since I'm
> puzzled whether it was done to accommodate some (perhaps now-obsolete)
> variation of select() that required that.

> Thomas E. Dickey <address@hidden>

This doesn't help (15d snapshot).

We are still busy waiting for select() in HTCheckForInterrupt() for 0.1 sec.
Do we need this? Perhaps this is an atrefact before DontCheck() invention.
We may test stdin once nicely, man select():

        The TIMEOUT value may be a NULL pointer (no timeout, i.e., wait
        forever), a pointer to a zero-value structure (poll mode, i.e., test
        once and exit immediately), or a pointer to a `struct timeval'
        variable (timeout: `select' will repeatedly test all the descriptors
        until some of them become ready, or the timeout expires).

        `struct timeval' is defined as follows:

             struct timeval {
               time_t tv_sec;
               long tv_usec;
             };

So the following patch proposed:

--- lyutils.15d 2003-05-12 12:13:08.000000000 +0000
+++ lyutils.c   2003-05-12 13:54:10.000000000 +0000
@@ -1550,12 +1550,13 @@ PUBLIC int HTCheckForInterrupt NOARGS
        return((int)TRUE);
     }

     /** Curses or slang setup was not invoked **/
     if (DontCheck())
        return((int)FALSE);
+    /** else: not often than once per 0.1 second **/

 #if !defined(_WINDOWS) || defined(__MINGW32__)
 #ifdef USE_SLANG
     /** No keystroke was entered
        Note that this isn't taking possible SOCKSification
        and the socks_flag into account, and may fail on the
@@ -1567,13 +1568,13 @@ PUBLIC int HTCheckForInterrupt NOARGS
 #endif /* DJGPP_KEYHANDLER */
        return(FALSE);

 #else /* Unix curses: */

     socket_timeout.tv_sec = 0;
-    socket_timeout.tv_usec = 100;
+    socket_timeout.tv_usec = 0;  /* test once */
     FD_ZERO(&readfds);
     FD_SET(0, &readfds);
 #ifdef SOCKS
     if (socks_flag)
        ret = Rselect(1, (void *)&readfds, NULL, NULL,
                      &socket_timeout);


; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]