Science Fiction & Saturday Music

  • Humble Bundle Adventures in Science Fiction Books: Runs until Oct18, and everything in this that I’ve read (Anderson, Bear, Brunner, Ellison, Foster, Silverberg, Steele, Sterling, Swanwick) is excellent, and I’m enjoying Sergei Lukyanenko’s1 The Genome enormously. They’ve picked what looks like an all-good-stuff collection.

Saturday Music is a little spacey.

  1. I adore the Night Watch books; but because of what they say, or because they’re bound up in memories of rainy nights in Seattle reading at all-night cafés and public transit, very like the Moskva of the books? The first movie is great, but only about half the first book; the sequel movies are dire, some of the worst hatchet-jobs of adaptations I’ve ever seen. 

Swiftian Satire, or Tragedy?

I honestly cannot tell if Swift developers are seriously eating Irish babies, or taking the Mickey.

From bad implementations of Equatable and Hashable, the wag leaps to:

extension GridPoint : HashVisitable {
    func hash<H: Hasher>(_ hasher: inout H) {

Bravo! That’s easily the funniest punchline to a programming joke since “where do you think the chaos came from?”

Starts with the most bizarre strawman Objective-C Sieve of Erathosthenes I’ve ever seen. A real implementation would be in C, because Obj-C is C with objects, and it’d be massively faster:

#include <stdlib.h>
#include <stdio.h>

typedef char BOOL; // or link in Foundation
#define YES 1
#define NO 0

int main(int argc, char **argv) {
    if (argc != 2) {
        printf("Usage: primes COUNT\n");
    long n = atoi(argv[1]);
    BOOL p[n];
    p[0] = NO;
    p[1] = NO;
    for (long i = 2; i < n; ++i) {
        p[i] = YES;
    for (long i = 2; i < n; ++i) {
        for (long j = i*i; j < n; j += i) {
            p[j] = NO;
    for (long i = 1; i < n; ++i) {
        if (p[i]) {
            printf("%ld ", i);
    return 0;

This does use more lines of code, but they’re short, low-density, and it’s instantly obvious what it’s doing (my predilection for 1-char var names aside). Can you actually decode his filter-based version?

func sieve(_ sorted: [Int]) -> [Int] {
    guard !sorted.isEmpty else { return [] }
    let (head, tail) = (sorted[0], sorted[1..<sorted.count])
    return [head] + sieve(tail.filter { $0 % head > 0 })

let numbers = Array(2...1000000)
let primes = sieve(numbers)

And the runtime experiment:

mdh@Aegura:~/Code/CodeC% time clang -O3 -o primes primes.c                
clang -O3 -o primes primes.c  0.04s user 0.41s system 83% cpu 0.534 total
mdh@Aegura:~/Code/CodeC% time ./primes 1000000 >~/Desktop/primes.txt      
./primes 1000000 > ~/Desktop/primes.txt  0.02s user 0.00s system 89% cpu 0.025 total

mdh@Aegura:~/Code/CodeSwift% time swiftc -O -o swiftPrimes swiftPrimes.swift
swiftc -O -o swiftPrimes swiftPrimes.swift  0.57s user 0.64s system 69% cpu 1.754 total
mdh@Aegura:~/Code/CodeSwift% time ./swiftPrimes >~/Desktop/swiftPrimes.txt  
./swiftPrimes > ~/Desktop/swiftPrimes.txt  51.79s user 26.49s system 99% cpu 1:18.78 total

So the naïve C implementation is about 3,151x faster. I can’t measure it precisely because a limit measurable in C, would take Swift until the heat death of the Universe.

So here’s my question: Is Vincent aware of this, and his theme of “diabetes”, “sugar”, “saccharine”, etc. pointing at how fat, bloated, slow, and deadly Swift is? He never lets on if this is a joke, he keeps tossing more syntax layers on top of Swift.

AIM is being shut down and the Kids Today™ are sad. LiveJournal was driven under by Facebook, then bought by Russians and murdered for being gay. ICQ is still going, but nobody uses it. I miss USENET 🙁 . Blogs & blogrings were killed by Twitter but some of us are posting again.

Rock ‘n Roll Monday Music

There’s several other new albums I’ve liked this month, just weirds me out to have more than a few new albums per year that I gave a shit about. Not to be that cranky old guy #getoffmylawn, but seriously, Kids Today™ don’t listen to real music, so did all us olds just start listening again? Of course, one of those above is dead, and some others are so close you may as well put them in their coffins and start kicking in clods. But Chrissy Hynde’s still kicking ass and breaking hearts.

Rocky Mountain High not Sierra

Currently I won’t upgrade, I have a Fusion Drive which isn’t supported by APFS yet. I’m not desperate to upgrade for that, HPFS+ has never hurt me yet, I keep a reasonable backup schedule, my source control is backed up.

I waited until last month to upgrade to Sierra, I was working just fine on Mavericks, and only upgraded because Xcode (UGH!) required it. So my advice is usually very conservative: Wait until you absolutely have to.

That said, there’s new stuff that is interesting in High Sierra: VR and new image file formats. So I’ll likely upgrade sooner, once I see fusion drives supported and hear no more horror stories.

On a side & musical note, I’m already super tired of the California theme. The other 49 states and hundreds of other countries don’t like you that much, Cali.