May 27, 2015

Go: The price of interface{}

Posted in Software at 00:43 by graham

Go’s empty interface{} is the interface that everything implements. It allows functions that can be passed any type. The function func f(any interface{}) can be called with a string f("a string"), an integer f(42), a custom type, or anything else.

This flexibility comes at a cost. When you assign a value to a type interface{}, Go will call runtime.convT2E to create the interface structure (read more about Go interface internals). That requires a memory allocation. More memory allocations means more garbage on the heap, which means longer garbage collection pauses.

Read the rest of this entry »

May 13, 2015

Science fiction: Ancillary Sword

Posted in Society at 04:56 by graham

It was a gesture meant to comfort. Even if they hadn’t already known the reason for our coming, they could not have failed to notice my shaved head and the mourning stripe across my face, and Captain Hetny’s. These people didn’t know us, quite possibly didn’t know who had died. We represented the forces that had conquered them, torn them away from their home world to labor here. They had no reason to care for our feelings. They had no reason to think that either of us knew enough Delsig to understand the words. And no expectation that we would understand the import of their song even if we did. Such things are fraught with symbolic and historic significance, carry great emotional weight – but only for someone aware of that significance to begin with.

They sang it anyway.

From Ancillary Sword, by Ann Lecke.

If you’re going to read it, start with Hugo and Nebula away winner Ancillary Justice.