From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-x22a.google.com (mail-qt0-x22a.google.com [IPv6:2607:f8b0:400d:c0d::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 33C093B260 for ; Wed, 7 Dec 2016 17:01:10 -0500 (EST) Received: by mail-qt0-x22a.google.com with SMTP id c47so394487290qtc.2 for ; Wed, 07 Dec 2016 14:01:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=hf4N64R6bDqA44mpjbgT4hxlw4pYusi8AjCYWhkdIJA=; b=fZLP6BokHdL5LoD8RqyuDp9Ocbeo0DUzfTdcICcBXTCvor9QTwHTI/iYwm1pzY8YMB Tslu4NZGdTKadEbojuLK5lCmsEvplfIs/k4EI5358c8EwNaA63XDb6hwZCIptSkGvwIV BgJdePSFZYgCiKafR+p+XNL7nSLTIi2y9sO64R6D1+f9xkLJt0hUph4WL6RD+3qPkjwq 76GfQFkKuLS0O6QdbLaW9CrKZrGegGbb2ri+Stj4D85ozaskkmJWnlV6+gxIU0VVesUC +9ZtklzxfxFfT2nyjMI13NCOaNxV64dFD0AyIXwqz16RYL2RSFZL4+q6GpVm9xvkK1ur +K0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=hf4N64R6bDqA44mpjbgT4hxlw4pYusi8AjCYWhkdIJA=; b=Diwf20EWxYYNrRfp/obRtRmNeaelZ/HFf2UF3aYLcS5wJszKmS44EaRDlzobqHSObM NMWqqUHwQ0rYqQlmdiBU6WTUKEhF3OM47Ha7cI0GvjTsb9cwGBec6gBJI9cGkbgjOM63 08/66ikDt4uzdf2BpEBtEph1aC4BxgrzXMxk31blOunazMe2aAY6sIIqDpnaOp+ugTXm YknDIHuLJ7R4iH4Dfpt0DzZqQopB/R9htYm/dUpkzZKVPh9SqiqOMkkFtAHG5I2fcXyV cMyyuHbWMyypWG/HkejgufZD51k8gCyOaAaas4pWRd9p6fFseUFWxs88jkdYUYz7Vboy avjQ== X-Gm-Message-State: AKaTC0345S2zG3mT1cM9suzNo7pEWBw2eCa+nBjFDeTT5FuGnnv0dPpwXfgB71fnA0B0esB//DODa+UULtXofA== X-Received: by 10.237.61.210 with SMTP id j18mr62197684qtf.137.1481148069456; Wed, 07 Dec 2016 14:01:09 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.152.197 with HTTP; Wed, 7 Dec 2016 14:01:09 -0800 (PST) From: Dave Taht Date: Wed, 7 Dec 2016 14:01:09 -0800 Message-ID: To: "cerowrt-devel@lists.bufferbloat.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Cerowrt-devel] fun with go X-BeenThere: cerowrt-devel@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: Development issues regarding the cerowrt test router project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2016 22:01:10 -0000 I needed a break... I took some time out to try an optimize a critical section in esr's new loccount tool, which is written in go. From the profile, it appeared that character at a time I/O was woefully inefficient, and that replacing it all with mmap would speed things up by at least 2-4x. Analyzing the linux kernel currently take 24 seconds with loccount, about 90 sec with sloccount, so we already won big. But: I couldn't figure out how to make mmap work right in go for this application, so I rewrote the core routines in C... to get the runtime in my test code to - wait for it - .668 seconds on my dual core SSD equipped box. I really wasn't expecting a 30x speedup! And I'm thus tempted to either rewrite the whole thing in C, or try to figure out what makes go so slow. Or both. My (very incomplete) C version is here: https://github.com/dtaht/nloc And the loccount for go code is here: https://gitlab.com/esr/loccount Virtual beer to anyone that can speedup loccount.go by any amount. And explain why! --=20 Dave T=C3=A4ht Let's go make home routers and wifi faster! With better software! http://blog.cerowrt.org