Universal truths

The fact that channel communications (whatever their implementation details) take much, much longer than function calls seems to be a constant truth no matter what the programming language.  I don’t have the benchmarks for Erlang offhand, but here are ones that I just recently ran for Go: main.BenchmarkChannel-2     500000              6106 ns/op main.BenchmarkFunction-2        100000000               10.2 ns/op main.BenchmarkAnonymous-2       100000000               11.5 ns/op Here’s the source code in case you want to pick holes in my benchmark: package mainimport “testing”func BenchmarkChannel(b *testing.B) {        c := make(chan int, 1000)        accum := 0        go func() { for { accum += <-c } }()        for i := 0; i < b.N; i++ {                c <- i        }}func BenchmarkFunction(b *testing.B) {        accum := 0        for i := 0; i < b.N; i++ {                handle(i, &accum)        }}func handle(v int, accum *int) {        *accum += v}func BenchmarkAnonymous(b testing.B) {        accum := 0        f := func(i int) { accum += i }        for i := 0; i < b.N; i++ {                f(i)        }} This was run with: gotest -run -cpu=2 -bench=‘.‘ Changing GOMAXPROCS didn’t make any difference.

Read More

Just a rant

I need to get this out of my system.  It’s probably better if you just go ahead and skip this rant; there’s nothing constructive in it. Windows Windows sucks.  There’s really nothing more to say about it; it’s a horrible operating system, and I don’t know why anybody – especially anybody in a management position – would think that it’s suitable for running a business on.  It’s buggy, slow, bloated, and obtuse.  It’s so bad at being a server, I don’t even know where to begin criticizing it.  And as bad as it sucks being a server, it really sucks at being a desktop computer, too.

Read More
|

Incremental backups with btrfs

btrfs is teh win.  No, seriously.  It’s not the only file system that can do this, but it’s the first one I’ve had installed, and it’s beautiful, man. I got myself a little 2TB external USB 3.0 hard drive ($99!  Past Sean, be very jealous) and wrote a backup script; my first version had all of this complex Towers of Hanoi rotation scheme, but then I realized I didn’t need any of it if I used btrfs’s snapshots.  Now, my backup script consists mainly of: sg_start –start /dev/sdh   # Tell the drive to spin upmount /dev/sdh1 /mnt/backupsbtrfsctl -s /mnt/backups/backup-$todays_date </div>            /mnt/backups/backup-$yesterdays_datersync -va –numeric-ids –delete-before –ignore-errors </div>      –partial –inplace $backup_paths </div>      /mnt/backups/backup-$todays_datesyncumount /mnt/backupssg_start –stop /dev/sdh It does a little more than that (error checking, logging, etc), but not much more.  After the first backup, the disk usage was 15GB; ten days later, I have ten incremental backups, and it’s still 15GB.

Read More

tmux magic

I recently switched from GNU screen to tmux, so I’m discovering all of these awesome little features.  This morning, I found out (accidentally) that you can remotely script sessions, and here’s how it came about: I added a new back-up disk and back-up scheme (more on that later), and decided to do a little cleaning while I was at it.  I’ve got 10 years of digital photography in one drive, much of which isn’t very well organized.

Read More
|

RML: Readable Markup Language

In answer to my own post, I spent last weekend implementing my own markup language.  You can find the results here (and the source here).  FWIW.  It’s version 1.0, which means it works, but it doesn’t have all of the features I want.  A summary can be found here.  I’m pretty pleased with it so far.

Read More

Never satisfied

Every once in a while I find myself wasting a couple of hours re-trolling through the Wikipedia entry for lightweight markup languages, searching for the perfect markup system.  They are all deficient in some way, and it’s becoming increasingly evident that I’m either going to have to pick the least deficient one and write additional software for transforming it (ugh), or come up with my own (yeauck!). As a preface, I’ll just say that TeX is a non-starter; any tool that requires TeX (or LaTeX, or any derivation thereof) is not an option.

Read More

Now we get to the annoying aspects of Go

I’ve spent another ten hours or so writing extensive functional tests for my code, and fixing bugs, so I have some further thoughts about Go. POLA gotest continues to be easy to use and is versatile, even if you do have to implement a bunch of basic functionality yourself (there are no convenient “assert” functions, there’s no setup or teardown functionality, and nothing like TestNG’s DataProvider mechanism).  Even functional testing of a server process is easier than in other languages, although I think most of that is again due to Go helping me separate my code into modules.

Read More

More Golang adventures

I recently wrote a little application called ConfigServer (although the project will probably be renamed). It is intended to be a tool to assist release managers and software deployments by providing a central server to hold configurations, but also allow configurations to be version controlled. ConfigServer provides some inheritance capability, the idea being that you can have a Cluster configuration, a Server configuration that inherits properties from the Cluster, and an Application configuration that inherits from the Server – ConfigServer doesn’t care about the schema, actually, but that’s an implementation detail.

Read More

Restructuredtext vs Asciidoc

This will be brief: RST beats Asciidoc.  I actually prefer Asciidoc’s syntax; it uses markup inherited from the markup people have been using in emails for more than a dozen years, while RST is hacky, obtuse, and contrived.  I never will understand why people ignore defacto, organic standards in favor of inventing new standards which are worse.  In any case, Asciidoc’s syntax is better – but the parse rules are just too involved.

Read More

JVM hate

I came across this paper, published by Google, comparing benchmarks in Scala, C++, Java, and Go.  Scala comes out on top (well, under C++) in performance, by a decent margin.  This surprised me a bit, but makes me happy – Scala is a functional language, and I do think functional languages are the (medium) future of software development.  My main beef with Scala is the JVM. There are (in my mind) several problems with the JVM.

Read More