From: Dave Taht <dave.taht@gmail.com>
To: "cerowrt-devel@lists.bufferbloat.net"
<cerowrt-devel@lists.bufferbloat.net>
Subject: [Cerowrt-devel] fun with go
Date: Wed, 7 Dec 2016 14:01:09 -0800 [thread overview]
Message-ID: <CAA93jw7FaPNFN5t0vkZtOxdi6iQQW7+qYWzG6+S0kQ7NXpnT5Q@mail.gmail.com> (raw)
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!
--
Dave Täht
Let's go make home routers and wifi faster! With better software!
http://blog.cerowrt.org
reply other threads:[~2016-12-07 22:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.bufferbloat.net/postorius/lists/cerowrt-devel.lists.bufferbloat.net/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAA93jw7FaPNFN5t0vkZtOxdi6iQQW7+qYWzG6+S0kQ7NXpnT5Q@mail.gmail.com \
--to=dave.taht@gmail.com \
--cc=cerowrt-devel@lists.bufferbloat.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox