Friday, 23 October 2015

Research Projects That Should NOT Be Funded

"Is there any feasible way to create a small black hole?"

"Is There A Better Route To Fusion?", slide 25.

KPMG Gets It Totally Wrong About Pittsburgh And Auckland

I lived in Pittsburgh for seven years (1994-2001) and have visited it multiple times since, as recently as last year. I've lived in Auckland for the last ten years. I got a PhD in computer science at CMU while I lived there, and of course I'm still working in tech in Auckland. So I was very interested to read KPMG's report on the lessons Pittsburgh holds for New Zealand ... but I was shocked by how different its conclusions are from my experiences.

Pittsburgh was a great place to live as a CMU student, mainly because the population and economy was so down that everything was cheap, especially rent. It's true that things have improved a bit since then in some ways --- Google opening an office there, for example --- but in many other ways things have gotten worse. City finances have been so bad over the last decade that bus services were being cut back to totally unreasonable levels. Multiple efforts to revitalize the downtown --- lauded by KPMG --- have basically failed; it's still a wasteland, and the Macy's that was the core of one of the more recent efforts closed down this year. The roads are unbelievably bad. I find Auckland by far a nicer city.

One thing Pittsburgh does have going for it is CMU and the tech companies that have grown up or built offices around it. Auckland has nothing like that. But here's what KPMG are recommending:

Simon Hunter says Pittsburgh provides a blueprint for Auckland thinking: "There's courage and focus on a specific group of young technical wealth creators; there's a massive contribution from the universities working together and from commercial entities - and there's urban renewal leveraging the rivers."
Almost none of that makes any sense to me. Auckland's geography is entirely different and with the exception of the wharves downtown, its waterfronts don't need "urban renewal". As for the universities and "commercial entities": Google, Intel, Apple etc are there entirely because CMU is there. CMU is there for historical reasons. (Andrews Carnegie and Mellon put it there, it rode a wave of DOD-funded computer science research, and accumulated enough gravitational pull to make it permanently one of the top four CS universities in the USA.) I like Auckland University but the gulf between it and CMU is vast and probably unbridgeable; at the very least, you would need to spend billions. There have been many, many extremely well-funded efforts to replicate CMU and its peers --- in Asia and the Middle East, for example --- and they haven't succeeded yet.

I do think we could do better at building an environment in Auckland or elsewhere in New Zealand that attracts outposts of the good big tech companies. I have some specific policy ideas. But aping Pittsburgh and CMU isn't going to work.

So in summary: Auckland beats Pittsburgh in most ways, and where Pittsburgh has advantages they don't translate here.

rr 4.0 Released With Reverse Execution

I finally got around to releasing rr 4.0!

rr is Mozilla's low overhead record-and-replay debugging tool for large C++ applications like Firefox. For more information see the rr project page, or watch my Technion talk:

rr 4.0 is the first stable release with reverse-execution enabled. This means gdb's reverse-continue, reverse-step, reverse-next and reverse-finish commands work under rr. Not only do they work, but under rr they're quite efficient and have unlimited scope. It's completely reasonable to reverse-continue from the end of a Firefox run all the way back to the beginning. Furthermore, breakpoints and hardware data watchpoints work with reverse execution. Suppose we're debugging Firefox layout:

Breakpoint 1, nsCanvasFrame::BuildDisplayList (this=0x2aaadd7dbeb0, aBuilder=0x7fffffffaaa0, aDirtyRect=..., aLists=...)
    at /home/roc/mozilla-inbound/layout/generic/nsCanvasFrame.cpp:460
460   if (GetPrevInFlow()) {
(gdp) p mRect.width
12000
We happen to know that that value is wrong. We want to find out where it was set. rr makes that quick and easy.
(gdb) watch -l mRect.width
(gdb) reverse-cont
Continuing.
Hardware watchpoint 2: -location mRect.width
Old value = 12000
New value = 11220
0x00002aaab100c0fd in nsIFrame::SetRect (this=0x2aaadd7dbeb0, aRect=...)
    at /home/roc/mozilla-inbound/layout/base/../generic/nsIFrame.h:718
718       mRect = aRect;
This is extremely powerful. rr's regular users inside (and outside) Mozilla have been enjoying this for a while on rr master, so we're glad to be able to get it into a stable release.

This release is about as stable as rr has ever been --- meaning it seems to be generally working for people and very few new issues have been coming in. However, rr depends on gnarly details of the kernel, system libraries and CPU so I expect as the number of rr users grows we'll need to keep fixing bugs and updating rr regularly.

By the way, Mozilla is interested in hiring people to work on rr-related technology, more closely integrated with the browser. I'd like to hear from people who're interested!

Saturday, 17 October 2015

Hobbiton

On Sunday afternoon I visited Hobbiton with a few Mozillians. It's a two-hour drive from Auckland to the "Lord of the Rings"/"Hobbit" Hobbiton movie set near Matamata ... a pleasant, if slightly tedious drive through country that looks increasingly Shire-like as you approach the destination. We arrived ahead of schedule and had plenty of time to browse the amusingly profuse gift shop before our tour started.

I'm an enthusiastic fan of The Lord Of The Rings and easily seduced by the rural fantasy of the Shire, but I enjoyed the tour even more than I expected. It's spring and the weather was fine, and Hobbiton is, among other things, a wonderful garden; it looked and smelled gorgeous. The plants, the gently worn footpaths, the spacing of the hobbit holes, the versimilitude of the props, all artfully designed to suggest artlessness --- it all powerfully suggests the place could be real, would be delightful to live in if only it was real, that it should be real. Adding to that the mythology of the movies and Tolkien's books, it was an intoxicating collision between fantasy and reality that kept me slightly off balance mentally.

After the tour proper we entered the Green Dragon Inn for a drink and dinner. The Inn continues the combination of fantasy and reality: carefully designed Shire-props next to "fire exit" signs, real drinks in pottery mugs. The highlight was the dinner feast: food piled on tables, looking like an Epicurean fantasy but actually real, copious and delicious. It's very memorable, great fun, and a bit silly in the best way.

After the dinner there was a walk back through Hobbiton in the dark, with lanterns, admiring the hobbit holes lit to suggest candles and firelight. It was gorgeous again.

Hobbiton is apparently a popular place to propose marriage. One happened on our tour, and another couple in our tour had done so two days before; they couldn't remember the rest of the tour after the proposal, so were repeating it.

The dinner tour is ridiculously expensive, but I thought it was very special and well worth it.

Friday, 9 October 2015

Heaphy Track

October 1-4 I walked the Heaphy Track with family. The weather was wet on the first day but cleared up nicely and as always we had a great time.

The Heaphy runs from the east end of Kahurangi National Park, near Golden Bay on the northern end of the South Island, west through the hills to the west coast of the South Island, and then south along the coast to the northern end of the road. (It can also be walked in the other direction.) Our first day was steady walking uphill, but not steep. The second day was up and down through the Gouland Downs at an elevation of around 800 metres. The third day is steady downhill to the coast, and the fourth day is along the coast, up and down a bit as you cross small ridges. The Heaphy is the longest Great Walk (about 80km) and we walked 5-6 hours each day. Since we generally set out from a hut at 8:30am or so, on the second and third days we arrived at our destination by 2 or 3pm, leaving plenty of time for card games, short walks and socializing!

One of the neat things about the Heaphy is the variety. Each day you're traveling through quite different terrain, all of it interesting. You really appreciate how the environment changes from the east side of Kahurangi to the west coast. I particularly enjoyed the coastal walk on the last day; that coast is truly wild, and parts can be walked off the track, on the beach. At times there is no sign of human presence whatsoever. The sand, surf, thick palm forest and mist work together to provide a feeling of isolation and timelessness.

Going into the walk I had a bit of a niggle in my right knee. That turned out to be no problem at all --- I didn't feel it since we started the walk, and it seems to be cured! On the second and third days I developed some severe ankle chafing against my boots --- skin worn through, with bleeding. So on the fourth day I walked barefoot the whole way. There wasn't as much time on sand as I thought, and the track was often rocky, so it wasn't particularly comfortable, but I found it surprisingly easy. My feet have learned to distinguish pain from damage; going barefoot was more painful than the ankle chafing, but there was no damage at all apart from a small cut on my big toe. That very evening my feet felt fine, but my ankles are still touchy today. Ironically the most painful part of the walk was the last five minutes where someone had helpfully laid gravel on the track.