Posts

Porting a Toy Path Tracer to Swift

I ported a toy path tracer to Swift. Some performance numbers: Colab, effectively single threaded: 3 Mrays/s iPhone 11 Pro Max: 18 Mrays/s iPad Pro 12.9" 2018: 21 Mrays/s iMac Pro 2017 18-core: 96 Mrays/s The hardest part of the port was reducing contention between threads. I had to replicate the tracing object (which contains the scene data) per thread in order to avoid serializing on ARC retain/release code. Swift currently has no way to share an immutable object graph across multiple threads without incurring ARC overhead every time any object in that graph is accessed. Perhaps when Swift implements some form of the Ownership Manifesto  this will be fixed.

Dropping a Dynabook: A comic that turned from Science Fiction to Science Fact

Image
Some time around 1982, I saw an amazing comic on the wall of a Xerox Alto computer room at the MIT AI Lab . Given the subject matter, I assume the comic was originally created at Xerox PARC , possibly as part of the NoteTaker project, but can't find any trace of it on the web. I have recreated it from memory, below. The comic is explaining the events that happen when a Dynabook is accidentally dropped off the top of Half Dome in Yosemite National Park . Note that a free-fall calculator  claims that it would take over 12 seconds for the Dynabook to hit the Yosemite Valley floor. T+00.000 Dynabook accidentally dropped from top of Half Dome. T+00.016 Dynabook notices that It can't sense its user. It is in zero gravity. There is a 200 MPH wind from below. Dynabook concludes that it is falling. Turns off the display to save memory.  Opens a radio connection to El Capitan radio tower. Begins backing up the user's recent changes. T+05.000 Dynabook hits...

Pro No Mo - I don't really need a MacBook Pro machine for hobby programming.

I've been trying to decide which Apple laptop to buy for hobby programming. I'm leaning towards the cheapest laptop Apple sells, the 2019 MacBook Air. As far as I can tell, is  fine for my current needs. I specced out a more powerful and future-proof laptop, a 2019 MacBook Pro with 2x the RAM and SSD storage, but it was 60% more expensive. I think it makes more sense for me to buy the cheaper laptop today, and plan on replacing it sooner. Especially because I have a lot of family members who would be fine with the cheaper laptop as a hand-me-down. It does feel a little weird to decide that I don't need a "Pro" machine. When it comes down to it, Xcode, a SSD and a retina display are all the "Pro" I need for hobby programming, and Apple has made those features available in the budget Air line.

The way I solved my daughter's "iMessage Activation" error

Writing these notes in case they help someone. My daughter recently tried to add her Apple ID to her iPhone'sApple Messages app. (Settings > Messages > Send & Receive > Add Apple ID) When she tried this, she got a dialog box where she could type in her Apple ID and password. After a 15 second delay she got an error dialog box: iMessage Activation   An error occurred during activation.         Try again She got a similar error message if she tried to activate FaceTime: FaceTime Activation   An error occurred during activation.         Try again I searched the Internet, and tried the various remedies that Apple and others suggested: Reboot Phone. Make sure the phone can receive SMS messages. Enable/disable iMessage and FaceTime. Log the iPhone out of iCloud and log back in again. Visit icloud.com and check the iCloud account to see if there's any warnings or errors. Update the phone OS to the latest re...

2018 iPad Pro 12.9" Report

After weeks of research and thought, I bought a iPad Pro 12.9" 3rd Generation. My impressions, based on a week's use: It's too expensive, especially once you include the pencil and keyboard case. It's a significant improvement over the 1st generation iPad Pro 12.9". It's physically much smaller. The new keyboard is nicer. The new pencil's magnetic charger makes it much more useful than before, because now it's always charged when I want to use it. Flaws The magnets holding the pencil to the iPad are too weak. It's easy to knock the pencil off the edge of the iPad when picking it up or carrying it. When the keyboard case is folded back, your hands touch the keys. This feels weird at first. The hardware is held back by iOS 12 and Apple App Store limitations. FWIW I think for most people the ordinary 2018 iPad, with a Logitech Crayon, would be a better purchase. But I do enjoy using it!

Solving the anemone puzzle in Botanicula

Botanicula is a whimsical graphical adventure game for the iPad and other computers. One of the puzzles near the end of the game requires a bit of thinking to solve. When I came upon it, after a couple of hours of play, I was too tired to think. So I wrote some code to brute-force the solution. I'm unreasonably pleased that it worked the first time. Here's the code, cleaned up and commented:

Computer History Museum Oral Histories

Image
The Computer History Museum Oral Histories are a wonderful project. They are deep, long, interviews with many different programmers. Lots of never-before-made-public details about important projects. For example, this oral history by Oral History of Kenneth Kocienda and Richard Williamson goes into details of how iOS was designed: Or if you prefer PDFs: Oral History Part 1 Oral History Part 2 One of the interesting things I found out was that there was an attempt to use HTML/Web APIs to write iPhone apps, and that for the first two or three iOS releases some of the apps, including the Stocks and Weather apps were implemented as HTML/Web apps.