aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorLars Ingebrigtsen2016-01-30 09:07:24 +0100
committerLars Ingebrigtsen2016-01-30 09:07:24 +0100
commit4d430711122c74964a0e22e026bc2cb0b5dad1a1 (patch)
treec76b57541db77dbe88f24ad8fd70e1bb40225599 /src/process.c
parente5b34678c42992d01ddd863e57ad5690327e1bc4 (diff)
downloademacs-4d430711122c74964a0e22e026bc2cb0b5dad1a1.tar.gz
emacs-4d430711122c74964a0e22e026bc2cb0b5dad1a1.zip
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.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/process.c b/src/process.c
index f9a822fcd0f..43fb6abaa9e 100644
--- a/src/process.c
+++ b/src/process.c
@@ -283,7 +283,7 @@ static int max_input_desc;
283static Lisp_Object chan_process[FD_SETSIZE]; 283static Lisp_Object chan_process[FD_SETSIZE];
284#ifdef HAVE_GETADDRINFO_A 284#ifdef HAVE_GETADDRINFO_A
285/* Pending DNS requests. */ 285/* Pending DNS requests. */
286static Lisp_Object dns_process[FD_SETSIZE]; 286static Lisp_Object dns_processes;
287#endif 287#endif
288 288
289/* Alist of elements (NAME . PROCESS). */ 289/* Alist of elements (NAME . PROCESS). */
@@ -3823,12 +3823,7 @@ usage: (make-network-process &rest ARGS) */)
3823 3823
3824 p->dns_requests = dns_requests; 3824 p->dns_requests = dns_requests;
3825 p->status = Qconnect; 3825 p->status = Qconnect;
3826 for (channel = 0; channel < FD_SETSIZE; ++channel) 3826 dns_processes = Fcons (proc, dns_processes);
3827 if (NILP (dns_process[channel]))
3828 {
3829 dns_process[channel] = proc;
3830 break;
3831 }
3832 } 3827 }
3833 else 3828 else
3834 { 3829 {
@@ -4708,17 +4703,20 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4708 break; 4703 break;
4709 4704
4710#ifdef HAVE_GETADDRINFO_A 4705#ifdef HAVE_GETADDRINFO_A
4711 for (channel = 0; channel < FD_SETSIZE; ++channel) 4706 if (!NILP (dns_processes))
4712 { 4707 {
4713 if (! NILP (dns_process[channel])) 4708 Lisp_Object dns_list = dns_processes, dns;
4709 struct Lisp_Process *p;
4710
4711 while (!NILP (dns_list))
4714 { 4712 {
4715 struct Lisp_Process *p = XPROCESS (dns_process[channel]); 4713 dns = Fcar (dns_list);
4714 dns_list = Fcdr (dns_list);
4715 p = XPROCESS (dns);
4716 if (p && p->dns_requests && 4716 if (p && p->dns_requests &&
4717 (! wait_proc || p == wait_proc) && 4717 (! wait_proc || p == wait_proc) &&
4718 check_for_dns (dns_process[channel])) 4718 check_for_dns (dns))
4719 { 4719 dns_processes = Fdelq (dns, dns_processes);
4720 dns_process[channel] = Qnil;
4721 }
4722 } 4720 }
4723 } 4721 }
4724#endif /* HAVE_GETADDRINFO_A */ 4722#endif /* HAVE_GETADDRINFO_A */
@@ -7569,15 +7567,15 @@ init_process_emacs (void)
7569 { 7567 {
7570 chan_process[i] = Qnil; 7568 chan_process[i] = Qnil;
7571 proc_buffered_char[i] = -1; 7569 proc_buffered_char[i] = -1;
7572#ifdef HAVE_GETADDRINFO_A
7573 dns_process[i] = Qnil;
7574#endif
7575 } 7570 }
7576 memset (proc_decode_coding_system, 0, sizeof proc_decode_coding_system); 7571 memset (proc_decode_coding_system, 0, sizeof proc_decode_coding_system);
7577 memset (proc_encode_coding_system, 0, sizeof proc_encode_coding_system); 7572 memset (proc_encode_coding_system, 0, sizeof proc_encode_coding_system);
7578#ifdef DATAGRAM_SOCKETS 7573#ifdef DATAGRAM_SOCKETS
7579 memset (datagram_address, 0, sizeof datagram_address); 7574 memset (datagram_address, 0, sizeof datagram_address);
7580#endif 7575#endif
7576#ifdef HAVE_GETADDRINFO_A
7577 dns_processes = Qnil;
7578#endif
7581 7579
7582#if defined (DARWIN_OS) 7580#if defined (DARWIN_OS)
7583 /* PTYs are broken on Darwin < 6, but are sometimes useful for interactive 7581 /* PTYs are broken on Darwin < 6, but are sometimes useful for interactive