diff options
author | Rich Felker <dalias@aerifal.cx> | 2012-04-01 23:22:16 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2012-04-01 23:22:16 -0400 |
commit | 4f346b08b33c9265c36fe8a14f5f908b1a9f296a (patch) | |
tree | d4e5c0c5b58302e39f56d550806d392e543974d3 /src/network | |
parent | 4dbd94112ff74064554054b5ff27a7af547e4899 (diff) | |
download | musl-4f346b08b33c9265c36fe8a14f5f908b1a9f296a.tar.gz musl-4f346b08b33c9265c36fe8a14f5f908b1a9f296a.tar.bz2 musl-4f346b08b33c9265c36fe8a14f5f908b1a9f296a.tar.xz musl-4f346b08b33c9265c36fe8a14f5f908b1a9f296a.zip |
improve name lookup performance in corner cases
the buffer in getaddrinfo really only matters when /etc/hosts is huge,
but in that case, the huge number of syscalls resulting from a tiny
buffer would seriously impact the performance of every name lookup.
the buffer in __dns.c has also been enlarged a bit so that typical
resolv.conf files will fit fully in the buffer. there's no need to
make it so large as to dominate the syscall overhead for large files,
because resolv.conf should never be large.
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/__dns.c | 2 | ||||
-rw-r--r-- | src/network/getaddrinfo.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/network/__dns.c b/src/network/__dns.c index 786c054a..1464513d 100644 --- a/src/network/__dns.c +++ b/src/network/__dns.c @@ -29,7 +29,7 @@ int __dns_doqueries(unsigned char *dest, const char *name, int *rr, int rrcnt) time_t t0 = time(0); int fd; FILE *f, _f; - unsigned char _buf[64]; + unsigned char _buf[256]; char line[64], *s, *z; union { struct sockaddr_in sin; diff --git a/src/network/getaddrinfo.c b/src/network/getaddrinfo.c index e5fa5191..93c75160 100644 --- a/src/network/getaddrinfo.c +++ b/src/network/getaddrinfo.c @@ -61,7 +61,7 @@ int getaddrinfo(const char *host, const char *serv, const struct addrinfo *hint, //char hostbuf[256]; char line[512]; FILE *f, _f; - unsigned char _buf[64]; + unsigned char _buf[1024]; char *z; int result; int cnt; |