[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] feature/async-dns 4d43071 1/2: Make async resolution more
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] feature/async-dns 4d43071 1/2: Make async resolution more efficient |
Date: |
Sat, 30 Jan 2016 08:09:11 +0000 |
branch: feature/async-dns
commit 4d430711122c74964a0e22e026bc2cb0b5dad1a1
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
Make async resolution more efficient
* process.c (wait_reading_process_output): Use a list of
process objects instead of looping through an array to check
for name resolution. This should be much faster.
---
src/process.c | 32 +++++++++++++++-----------------
1 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/src/process.c b/src/process.c
index f9a822f..43fb6ab 100644
--- a/src/process.c
+++ b/src/process.c
@@ -283,7 +283,7 @@ static int max_input_desc;
static Lisp_Object chan_process[FD_SETSIZE];
#ifdef HAVE_GETADDRINFO_A
/* Pending DNS requests. */
-static Lisp_Object dns_process[FD_SETSIZE];
+static Lisp_Object dns_processes;
#endif
/* Alist of elements (NAME . PROCESS). */
@@ -3823,12 +3823,7 @@ usage: (make-network-process &rest ARGS) */)
p->dns_requests = dns_requests;
p->status = Qconnect;
- for (channel = 0; channel < FD_SETSIZE; ++channel)
- if (NILP (dns_process[channel]))
- {
- dns_process[channel] = proc;
- break;
- }
+ dns_processes = Fcons (proc, dns_processes);
}
else
{
@@ -4708,17 +4703,20 @@ wait_reading_process_output (intmax_t time_limit, int
nsecs, int read_kbd,
break;
#ifdef HAVE_GETADDRINFO_A
- for (channel = 0; channel < FD_SETSIZE; ++channel)
+ if (!NILP (dns_processes))
{
- if (! NILP (dns_process[channel]))
+ Lisp_Object dns_list = dns_processes, dns;
+ struct Lisp_Process *p;
+
+ while (!NILP (dns_list))
{
- struct Lisp_Process *p = XPROCESS (dns_process[channel]);
+ dns = Fcar (dns_list);
+ dns_list = Fcdr (dns_list);
+ p = XPROCESS (dns);
if (p && p->dns_requests &&
(! wait_proc || p == wait_proc) &&
- check_for_dns (dns_process[channel]))
- {
- dns_process[channel] = Qnil;
- }
+ check_for_dns (dns))
+ dns_processes = Fdelq (dns, dns_processes);
}
}
#endif /* HAVE_GETADDRINFO_A */
@@ -7569,15 +7567,15 @@ init_process_emacs (void)
{
chan_process[i] = Qnil;
proc_buffered_char[i] = -1;
-#ifdef HAVE_GETADDRINFO_A
- dns_process[i] = Qnil;
-#endif
}
memset (proc_decode_coding_system, 0, sizeof proc_decode_coding_system);
memset (proc_encode_coding_system, 0, sizeof proc_encode_coding_system);
#ifdef DATAGRAM_SOCKETS
memset (datagram_address, 0, sizeof datagram_address);
#endif
+#ifdef HAVE_GETADDRINFO_A
+ dns_processes = Qnil;
+#endif
#if defined (DARWIN_OS)
/* PTYs are broken on Darwin < 6, but are sometimes useful for interactive