* [Cerowrt-devel] fun with go
@ 2016-12-07 22:01 Dave Taht
0 siblings, 0 replies; only message in thread
From: Dave Taht @ 2016-12-07 22:01 UTC (permalink / raw)
To: cerowrt-devel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-12-07 22:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-07 22:01 [Cerowrt-devel] fun with go Dave Taht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox