From owner-svn-src-all@FreeBSD.ORG Thu Oct 16 20:50:04 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E231106569F for ; Thu, 16 Oct 2008 20:50:04 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.188]) by mx1.freebsd.org (Postfix) with ESMTP id 0C9848FC16 for ; Thu, 16 Oct 2008 20:50:03 +0000 (UTC) (envelope-from max@love2party.net) Received: from vampire.homelinux.org (dslb-088-066-000-033.pools.arcor-ip.net [88.66.0.33]) by mrelayeu.kundenserver.de (node=mrelayeu4) with ESMTP (Nemesis) id 0ML21M-1KqZnG2z6K-0002JU; Thu, 16 Oct 2008 22:50:03 +0200 Received: (qmail 36290 invoked from network); 16 Oct 2008 20:50:02 -0000 Received: from fbsd8.laiers.local (192.168.4.151) by mx.laiers.local with SMTP; 16 Oct 2008 20:50:02 -0000 From: Max Laier Organization: FreeBSD To: "Poul-Henning Kamp" Date: Thu, 16 Oct 2008 22:50:00 +0200 User-Agent: KMail/1.10.1 (FreeBSD/8.0-CURRENT; KDE/4.1.1; i386; ; ) References: <200810162039.m9GKd21b070051@svn.freebsd.org> In-Reply-To: <200810162039.m9GKd21b070051@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200810162250.01303.max@love2party.net> X-Provags-ID: V01U2FsdGVkX1/F36BSVSZqZxSvWneIjE9l4X6ZlJXvzRB/VEn zQbXldxf2s5EwSNNaWewfBk1buzK0IMIqNClElcmeQvKhNyVEv Hec0j5pYiVIR/APUepqrg== Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r183960 - head/usr.bin/ministat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 20:50:04 -0000 On Thursday 16 October 2008 22:39:02 Poul-Henning Kamp wrote: > Author: phk > Date: Thu Oct 16 20:39:02 2008 > New Revision: 183960 > URL: http://svn.freebsd.org/changeset/base/183960 > > Log: > Make ministat(1) vastly faster on huge datasets. > > Modified: > head/usr.bin/ministat/Makefile > head/usr.bin/ministat/ministat.c ... > static void > AddPoint(struct dataset *ds, double a) > { > - struct point *pp, *pp2; > + double *dp; > > - pp = calloc(1, sizeof *pp); > - pp->val = a; > - > - ds->n++; > + if (ds->n >= ds->lpoints) { > + dp = ds->points; > + ds->lpoints *= 4; > + ds->points = calloc(sizeof *ds->points, ds->lpoints); > + memcpy(ds->points, dp, sizeof *dp * ds->n); + free(dp); ??? > + } > + ds->points[ds->n++] = a; > ds->sy += a; > ds->syy += a * a; > - if (TAILQ_EMPTY(&ds->list)) { > - TAILQ_INSERT_HEAD(&ds->list, pp, list); > - return; > - } > - TAILQ_FOREACH(pp2, &ds->list, list) { > - if (pp->val < pp2->val) { > - TAILQ_INSERT_BEFORE(pp2, pp, list); > - return; > - } > - } > - TAILQ_INSERT_TAIL(&ds->list, pp, list); > } -- /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News