From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Calling 'select' from emacs_gnutls_pull Date: Fri, 22 Feb 2013 14:36:46 +0200 Message-ID: <83ehg8mso1.fsf@gnu.org> References: <83wqu8qyik.fsf@gnu.org> <87fw0w6yny.fsf@lifelogs.com> <83txpcqjzs.fsf@gnu.org> <87k3q0wqef.wl%claudio.bley@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1361536604 26998 80.91.229.3 (22 Feb 2013 12:36:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 22 Feb 2013 12:36:44 +0000 (UTC) Cc: emacs-devel@gnu.org To: claudio.bley@gmail.com (Claudio Bley) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 22 13:37:06 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U8rs9-0000VP-Cd for ged-emacs-devel@m.gmane.org; Fri, 22 Feb 2013 13:37:05 +0100 Original-Received: from localhost ([::1]:38839 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8rrp-0001Wp-0o for ged-emacs-devel@m.gmane.org; Fri, 22 Feb 2013 07:36:45 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:54189) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8rrg-0001VX-2a for emacs-devel@gnu.org; Fri, 22 Feb 2013 07:36:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8rrZ-0004Ks-Mf for emacs-devel@gnu.org; Fri, 22 Feb 2013 07:36:35 -0500 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:58045) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8rrZ-0004KL-Em for emacs-devel@gnu.org; Fri, 22 Feb 2013 07:36:29 -0500 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0MIM00200G8HIN00@a-mtaout21.012.net.il> for emacs-devel@gnu.org; Fri, 22 Feb 2013 14:36:27 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MIM002DFGCRE770@a-mtaout21.012.net.il>; Fri, 22 Feb 2013 14:36:27 +0200 (IST) In-reply-to: <87k3q0wqef.wl%claudio.bley@gmail.com> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:157261 Archived-At: > From: claudio.bley@gmail.com (Claudio Bley) > Date: Fri, 22 Feb 2013 12:15:36 +0100 > > However, applying the obvious patch: > > --- >8 --- > --- src/w32.c Thu Feb 21 14:35:43 2013 > +++ ../build/src/w32.c Fri Feb 22 08:32:35 2013 > @@ -7837,27 +7837,9 @@ > > err = errno; > > + /* Translate the WSAEWOULDBLOCK alias EWOULDBLOCK to EAGAIN. */ > if (err == EWOULDBLOCK) > - { > - /* Set a small timeout. */ > - timeout = make_emacs_time (1, 0); > - FD_ZERO (&fdset); > - FD_SET ((int)fd, &fdset); > - > - /* Use select with the timeout to poll the selector. */ > - sc = select (fd + 1, &fdset, (SELECT_TYPE *)0, (SELECT_TYPE *)0, > - &timeout, NULL); > - > - if (sc > 0) > - continue; /* Try again. */ > - > - /* Translate the WSAEWOULDBLOCK alias EWOULDBLOCK to EAGAIN. > - Also accept select return 0 as an indicator to EAGAIN. */ > - if (sc == 0 || errno == EWOULDBLOCK) > - err = EAGAIN; > - else > - err = errno; /* Other errors are just passed on. */ > - } > + err = EAGAIN; > > emacs_gnutls_transport_set_errno (process->gnutls_state, err); > > > --- >8 --- > > and made a few tests using POP3 and IMAP connections over TLS and > HTTPS connections. Works good. That's good news. > Average for with-select key over 3 runs > > Version Number: Windows NT 5.1 (Build 2600) > Exit Time: 1:00 am, Monday, January 1 1601 > Elapsed Time: 0:00:35.208 > Process Time: 0:00:05.822 > System Calls: 659366 > Context Switches: 138074 > Page Faults: 61507 > Bytes Read: 80719977 > Bytes Written: 320584 > Bytes Other: 908395 > > > Average for without-select key over 3 runs > > Version Number: Windows NT 5.1 (Build 2600) > Exit Time: 1:00 am, Monday, January 1 1601 > Elapsed Time: 0:00:33.796 > Process Time: 0:00:06.166 > System Calls: 857893 > Context Switches: 140154 > Page Faults: 69061 > Bytes Read: 99353998 > Bytes Written: 2017152 > Bytes Other: 1175082 The times look comparable, but I'm confused why byte counts are so much different. Is there a good explanation to that? Anyway, AFAIU, your tests indicate that it would be okay to install the above changes on the development trunk, right? Thanks for your valuable feedback.