| To: | djbdns Mailing List <dns@list.cr.yp.to> |
|---|---|
| Subject: | Re: djbdns-1.05-epoll + speedup patch |
| From: | Sami Farin <safari-dns@safari.iki.fi> |
| Date: | Mon, 5 Mar 2007 16:47:46 +0200 |
| Delivered-to: | sp-com-lists@consult.net |
| Delivered-to: | gmail-djbdns@securepoint.com |
| Delivered-to: | sp.com.list@gmail.com |
| Delivered-to: | mailing list dns@list.cr.yp.to |
| In-reply-to: | <20070305142437.GA27256@odin.dempsky.org> |
| Mail-followup-to: | djbdns Mailing List <dns@list.cr.yp.to> |
| Mailing-list: | contact dns-help@list.cr.yp.to; run by ezmlm |
| References: | <20070116171333.GA5674@m.safari.iki.fi> <20070222122129.GE3982@m.safari.iki.fi> <20070222162522.GG3982@m.safari.iki.fi> <20070304161657.qrytvzoi37inmj45@m.safari.iki.fi> <20070305142437.GA27256@odin.dempsky.org> |
| User-agent: | Mutt/1.5.14 (2007-02-12) |
On Mon, Mar 05, 2007 at 08:24:37 -0600, Matthew R. Dempsky wrote:
> On Sun, Mar 04, 2007 at 06:16:57PM +0200, Sami Farin wrote:
> > +static inline void dns_sortip(char *s,unsigned int n)
> > +{
> > + int i;
> > + unsigned int rnd;
> > + char tmp[4];
> > +
> > + n >>= 2;
> > + for (i = n - 1; i > 0; i--) {
> > + rnd = dns_random() % n;
> > + byte_copy(tmp,4,s + (i << 2));
> > + byte_copy(s + (i << 2),4,s + (rnd << 2));
> > + byte_copy(s + (rnd << 2),4,tmp);
> > + }
> > +}
>
> Beware this does not generate the same distribution as:
Not that it matters much, but version 20070305T031624Z
already compares >= 0. It also does one useless loop
if n == 1 before for-loop unless I check for it. But dns_sortip
is called by dnscache only with n == 64 (16).
tdlookup.c:doit() has also dns_random (and divide instruction) usage
which can be optimized... maybe 10-20% (at max) (depending on CPU)
improvement in micro-benchmark of 1000000 queries for which
tinydns returns eight A records.
I can post the patch if someone cares.
--
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: djbdns-1.05-epoll + speedup patch, Matthew R. Dempsky |
|---|---|
| Next by Date: | Re: djbdns-1.05-epoll + speedup patch, Matthew R. Dempsky |
| Previous by Thread: | Re: djbdns-1.05-epoll + speedup patch, Matthew R. Dempsky |
| Next by Thread: | Re: djbdns-1.05-epoll + speedup patch, Matthew R. Dempsky |
| Indexes: | [Date] [Thread] [Top] [All Lists] |