Windows 8, Not So Bad

I’ve installed Windows 8 on my main desktop machine, and it’s not as bad as the developer preview and the RC. tl;dr: Can I recommend it, despite what you’ve read about in the press? Yes, and I didn’t think I’d say that.

Pros It is fast. Surprisingly so. Cold boot takes under 5 seconds, down from about 10 seconds under Windows 7 on my machine. It is modern. I know that’s the hype, but it does feel less ‘crufty’ than previous versions of Windows. You really don’t have to use the Metro start menu, if you pin the apps that you do use to the task bar, or as desktop shortcuts. You can even boot straight into it if you really want to. You need to learn some new keyboard shortcuts.

  • Win key on its own to toggle between desktop and the current application.
  • Win+Q for context-sensitive searching (i.e. in the application you are currently running).
  • Win+Tab to switch between desktop + Metro apps.
  • Win+C for the ‘charm’ bar.
  • Win+I to locate the Shutdown menu (or you could just press ‘Off’ on the PC like you would do on any other consumer device).
  • And Win+X for the ‘power menu’. The equivalent mouse actions are really just mousing to a corner, then moving the mouse up/down that side of the screen to bring the menu into context.

Cons These are all minor, so perhaps some will be addressed in SP1. You need to learn some new keyboard shortcuts. Some dumb pop up bubbles on the desktop, the first time Windows runs would have been a great idea. I guarantee that most regular consumers that have PCs and are not techies will never learn or know about these key combos. Curiously, for all the new key combos, there doesn’t seem to be ones for page left and right in metro apps: using the up-down mouse scroll wheel to move left and right feels weird. Maybe there are some key combos that do this, but I haven’t found them yet. If you’re a techie, you’ll notice that you need a web account to login, but this can be changed back to a local account. In fact you might prefer to do this because if you have NAS box (like I do), for some reason I still haven’t resolved, the NAS box won’t accept credentials coming from the Windows 8 web user account I have set up. Metro or ‘Store Apps’. Windows 8 ships with some, and at the moment the Windows Store is relatively empty, but it feels like the complaint people had with the iPad: Metro Apps seem (that ship with Windows 8) are for information

consumption, and not for productivity. If you want to type anything into anything, chances are you’ll have to go back to a desktop app. I’m just not using the Metro apps so far: in fact I don’t want to be tied to Internet Explorer in Metro mode, so I’m still using Google Chrome, and the supplied Windows 8 Metro apps have (many) website equivalents, so I am rarely using Metro apps at the moment. Perhaps the stupidest thing I’ve found is searching the Windows Store: you’d think that Microsoft would want it to succeed. Try and find an application in it. If you’ve read above, you’d know to press Win+Q once you’re in the Metro Store application. If you don’t know that, you will miss out on lots of other applications. Why on earth there isn’t a search box in the main page of Windows Store Metro app baffles me.

Finally Will your parents ‘get it’? Probably: if you show them the mouse gestures to get to the menus, then yes, and they may find it easier than previous versions of Windows. It might seem like there are more cons than pros here, but really, it’s just Windows 7 with a funny new menu.

Go Performance

I’ve been learning Go over the past couple of weeks to get a broader view of languages, programming styles and idioms in general. Working purely in C++ can give you a slightly blinkered view. When you look at other languages you need to initially accept their way of doing things before you question it.

Hacker News, in particular, seems to mention Go a few times a week, and there is generally something interesting in each post.

One thing that comes up is Go performance, and interestingly, there is this post on Krzysztof Kowalczyk’s website.

The post refers to the alioth benchmark shootout web site with a comparison of Go to Java 7, finding that Java 7 is generally faster than Go in the benchmarks. What Krysztof’s post also describes is the uneven implementation of the benchmarks: the Java version (and presumably the C and C++ versions) are closer to the optimal implementation for those languages than the Go version is.

In short this benchmark site, whilst good for a quick look up of performance for mature languages with large developer communities, isn’t particularly good for new languages with smaller development communities. As with anything on the web these days, take it with a pinch of salt.

What is Go good for? As long as you don’t want a GUI (though you can use Qt bindings), any console or server side process can usefully be written in Go. Through correct use of go-routines, your process will scale with the number of CPUs/cores (concurrency is not parallelism). Not many other popular languages offer this out of the box, and certainly not with such ease and readability.

The general feeling I have from the last few weeks of searching, reading and watching Go articles and videos, is that Python and Ruby may (YMMV) be usefully retired in favour of Go, and for pure development speed with reduced development bugs, many C and C++ tasks may also be usefully replaced with Go (except where raw performance is a consideration). Go is a young language and performance is only going to get better.

Common wisdom in computer science is ‘use the best tool available’, and in terms of programming languages: ‘use a domain specific language’, yet many, many, developers still cling to one language to solve all problems when others are much more applicable. Even though Go doesn’t really have classic OO, or generics, I think Go is going to become an increasingly popular and useful language as it is currently one of the best tools available for getting improved performance on improving hardware without having to rewrite the code.

I just have to find a useful project to Go on: for the man with a hammer, everything looks like a nail!!

Go – simple examples

The video in the previous post, showed how to use channels and start goroutines to turn a sequential task into a concurrent task.

A brief aside for those that are curious: some performance benchmarks can be found here. The go compiler has two different compiler implementations, one of which is gccgo which benefits from using the underlying gcc compiler toolchain, and gcc compiler optimization passes. This is also the version that can compile on solaris (if anyone still uses it). Go code compiled under gccgo may be faster than that which is compiled under the regular Go compiler.

An interesting and simple example was mentioned in the video, and can be found here in the go-play area:

// A concurrent prime sieve

package main

// Send the sequence 2, 3, 4, ... to channel 'ch'.
func Generate(ch chan<- int) {
    for i := 2; ; i++ {
        ch <- i // Send 'i' to channel 'ch'.
    }
}

// Copy the values from channel 'in' to channel 'out',
// removing those divisible by 'prime'.
func Filter(in <-chan int, out chan<- int, prime int) {
    for {
        i := <-in // Receive value from 'in'.
        if i%prime != 0 {
            out <- i // Send 'i' to 'out'.
        }
    }
}

// The prime sieve: Daisy-chain Filter processes.
func main() {
    ch := make(chan int) // Create a new channel.
    go Generate(ch)      // Launch Generate goroutine.
    for i := 0; i < 10; i++ {
        prime := <-ch
        print(prime, "\n")
        ch1 := make(chan int)
        go Filter(ch, ch1, prime)
        ch = ch1
    }
}

And generating the fibonacci sequence on the go-play site:

package main

func fib() func() int {
    a, b := 0, 1
    return func() int {
        a, b = b, a+b
        return b
    }
}

func main() {
    f := fib()
    //  evaluated left to right
    println(f(), f(), f(), f(), f())
}