Josh Betz

Engineer, Solver of problems, Wisconsin Badger

Spinlocks in Webkit

When I got my first Mac a little over four years ago, the first thing I did was install the nightly build of Webkit. Since then I’ve used a host of different browsers, but recently came back to Safari. This article reminded me why I was using the nightly builds of Webkit back then. It’s noticeably faster and I doubt TCSpinLock is the only reason.

Yes, we really did achieve a 3.7X speedup on a garbage collection benchmark by removing a call to sleep().

Why sleep()?

The original TCSpinLock was benchmarked against ten threads running on four CPU cores. In this environment, one thread could monopolize a CPU core, while the thread holding the lock didn’t run at all. Sleeping a little bit was a simple way to guarantee that the thread holding the lock got the CPU.

Why not just use the standard library locks?

Our spinlocks take advantage of a critical optimization: Knowing they’ll be held for a short time. Since spinlocks never sleep, they recover from contention as quickly as possible. As the profile showed, standard locks are much more conservative, and they may even idle a CPU core.

Current iPhone Screen

Inspired by Alex, Daniel, and Andrew’s posts.

20120913-170829.jpg

Spotify vs. Rdio

I’ve been a happy Spotify user since Memorial Day weekend 2012 when I discovered that a friend had signed up for the premium service. They were offering a 30 day trial, so I decided to try it out. It was kind of amazing. And it got better when I had to migrate over to a new MacBook Air. The billboard playlists, collaborative playlists, Last.fm integration — all super awesome, not to mention the massive music collection I now had access to.

I also had an Rdio account. Just the free one, but I had an account. I noticed Daniel Bachhuber followed me, which made me realize that there were actually a bunch of people I knew using Rdio. So I followed a couple people.

Here’s the thing — I didn’t really understand this when Daniel first asked why I switched, but having Spotify so locked into Facebook is kind of a deal breaker for me. I had just come to expect that the “People” tab in Spotify was useless. I didn’t really care about what most of those people were listening to and there’s no way to do anything about that. Not only that, the only way to follow someone on Spotify is to friend them up on Facebook. It’s kind of unfortunate because without looking at my notes, I feel like Spotify is the better service. The reality is that they both do almost exactly the same thing in every way with a bunch of tiny differences. So I’ll share the differences that I found between the two. There’s no way this is a complete list, but it’s the stuff I found right away, so probably most of the stuff that’s important to me — for what that’s worth. This is directly from my notes, so the order I noticed these in might be interesting.

Spotify

  • Billboard playlists, but I found a pretty good Billboard Country playlist on Rdio as well. The one on Spotify is actually maintained by Billboard, which is cool.
  • Starred playlist. The work around for this in Rdio is to create a playlist called “Starred” and add songs to it. The nice thing about the Spotify starred playlist is the extra UI — you can see which songs are starred and which aren’t immediately and it’s one action instead of three to add something to that playlist.
  • Spotify Play Button – It looks way better than the Rdio embedable widget and works as a remote for the app.
  • Apps. I already touched on this a bit with the Billboard playlists, but Spotify has apps and some of them are really pretty awesome.
  • Filter. ⌘F lets you filter a playlist to find the song you’re looking for. Blows my mind a bit that Rdio doesn’t have this.
  • Local collection. Neither of them have every song I want to listen to. The Beatles are nowhere to be found. On Spotify I can just use the Beatles music that I already have in iTunes and play it in Spotify. It even syncs to Spotify on my iPhone.
  • Playlist folders
  • Boxee app. With airplay, I probably wouldn’t use the Boxee app as much anyway, but it’s kind of cool that it exists.
  • Rdio mini player. I don’t find it super useful and they completely hijack the maximize button to take you to the mini player. Even holding option while you click the maximize button doesn’t make it work like it’s supposed to.

Rdio

  • Collaborative playlists. So, they both have collaborative playlists, but Rdio does them better — I think. As far as I can tell, there’s no way to limit who can collaborate on a playlist with you on Spotify. On Rdio, you get an extra option betwen ‘Just Me’ and ‘Everyone’ — ‘Only people that I follow’.
  • Play history. Here’s a simple one that I can’t find anywhere in Spotify. Rdio has it though!
  • Web app! You can log into Rdio from anywhere with an internet connection and play music. Also, feels like a web app. You get used to it fast, but it’s blatantly obvious that the desktop app is just a Web View of the the Rdio website, which it turns out is better than no native app at all.
  • Family plan. If you need that sort of thing, Rdio offers discounts for people with multiple accounts.
  • Sign in to Last.fm once. For reasons I don’t understand, you have to sign into Last.fm every time you install a Spotify app. It doesn’t work at all on the Spoify Boxee app
  • “Find a song to add to this playlist”. There’s a box at the top of every Rdio playlist to search for songs and add them directly to the playlist.

Conclusion

Spotify is the better music player. If you don’t care about social, that’s the place to start. Unfortunately it’s completely off limits for people without Facebook accounts. It would be nice if there was a way to hide the “People” menu, which is only there to make you think Spotify is social. Spotify’s real social strategy is to just let Facebook handle it.

Ultrabooks aren’t MacBook Air Clones?

Melanie Pinola:

Sleek silver Ultrabooks arriving from major PC manufacturers aren’t just Apple Macbook Air clones. Some of them even have options that Apple’s laptop doesn’t offer.

She goes on to point out the most minute details that make Ultrabooks different from a MacBook Air. Then, somehow we come to the assertion that Ultrabooks have to run Windows.

Even though some laptops do look exactly like the MacBook Air, often there are significant differences inside. Besides running Windows, using Intel processors, and meeting the thinness requirement, laptop makers are free to adapt Intel’s specifications for Ultrabooks as they see fit.

I was curious about that so I did a quick search on Wikipedia and found the requirements. It doesn’t appear as though Windows is required. As for adapting the specs how they see fit, I put together a comparison on the Verge. Other than the fact that we’re in the middle of a transition from Sandy Bridge to Ivy Bridge, none of them really stand out from a MacBook Air.

The Beer Game or Why Apple Can’t Build iPads in the US

The Beer Game explains why Apple can’t build iPads in the US. It’s not labor costs, it’s the supply chain. Apple could build a factory to assemble devices in the U.S., but all the components come from China anyway.

In the end, we had lost hundreds of dollars in backorders and excess inventory and were cursing out our upstream or downstream vendors for being idiots.

The lessons of the Beer Game are pretty evident. Delay in the supply chain causes amplified downstream problems. The problem wasn’t that we were kids running beer supply, the problem was the structure of the chain itself. Small changes at the front end lead to massive mistakes down the line.

From the transcript of This American Life’s “Retraction” episode:

But labor is such an enormously small part of any electronic device, right? Compared to the cost of buying chips or making sure that you have a plant that can turn out thousands of these things a day or being able to get strengthened glass cut exactly right within, you know, two days of this thing being due, that’s what’s important. Labor is almost insignificant. What is really important are supply chains and flexibility of factories.

« Previous PageNext Page »