From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Asynchronous DNS resolving Date: Fri, 13 Feb 2015 18:10:24 +1100 Organization: Programmerer Ingebrigtsen Message-ID: <877fvmffrz.fsf@building.gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1423811470 23020 80.91.229.3 (13 Feb 2015 07:11:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Feb 2015 07:11:10 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 13 08:11:00 2015 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 1YMAOx-0003pi-RF for ged-emacs-devel@m.gmane.org; Fri, 13 Feb 2015 08:10:59 +0100 Original-Received: from localhost ([::1]:53719 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMAOx-0007FT-3L for ged-emacs-devel@m.gmane.org; Fri, 13 Feb 2015 02:10:59 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58161) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMAOt-0007FN-BC for emacs-devel@gnu.org; Fri, 13 Feb 2015 02:10:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YMAOq-0004nJ-4O for emacs-devel@gnu.org; Fri, 13 Feb 2015 02:10:55 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:60371) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMAOp-0004mz-Td for emacs-devel@gnu.org; Fri, 13 Feb 2015 02:10:52 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YMAOj-0003iB-2i for emacs-devel@gnu.org; Fri, 13 Feb 2015 08:10:49 +0100 Original-Received: from 27.96.197.126 ([27.96.197.126]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 13 Feb 2015 08:10:45 +0100 Original-Received: from larsi by 27.96.197.126 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 13 Feb 2015 08:10:45 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 49 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 27.96.197.126 Mail-Copies-To: never User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:QGYzBSZ+SCE/lcU74b8KGRtw7MU= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:182989 Archived-At: The major usability problem in eww now seems to be synchronous DNS resolution. When you go to a web page, eww will render it, and then insert images asynchronously. All the network stuff happens pretty asynchronously -- except for the DNS lookups. If you're unlucky, a lookup may take several seconds, and there may be several of these lookups. Meanwhile, Emacs is pretty much frozen while waiting for the DNS packets to find their way back to home base... This is seriously yucky. A few years back I looked into making the Emacs domain lookup thing be asynchronous, but that was way beyond my knowledge of Emacs internals, and what happens when I fork Emacs, and what Emacs Lisp primitives can be used in the forked instance. So perhaps doing what Firefox used to do in the 90s would be a possibly solution, anyway? That is, have a teensy multi-threaded executable that reads commands from STDIN and outputs the replies on STDOUT. Like lib-src/dns-helper.c or something. The command format would be something like I.e., 45 lookup fsf.org 46 lookup images.fsf.org ... (Tags for streaming commands and matching up the responses with the requests, a la IMAP.) We'd then have something like (with-domain-name-lookup (ip "fsf.org") (message "We got %s and now we're going to connect" ip) (with-url ("http://fsf.org" :ip-address ip ...) (pop-to-buffer (current-buffer)))) to do a completely asynchronous web request. Or does anybody have a better idea for solving this problem? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/