Firefox 3.5 and the Beach Ball

I’m using Firefox 3.5 on Leopard, and noticing several slowdowns.

When we say Firefox 3.5 is fast, we mean it sometimes slows down. And by “sometimes slows down”, we mean the spinning beach ball of death.

Here are two cases where I see problems.

First, I see a severe slowdown in the Amazon.com search field. The slowdown occurs when I type a few characters and then hit the “:” key. For instance, try searching for “Bitter:Sweet”. Who knows if this is an Amazon or a Firefox problem. I just know it is slow.

The second slowdown was far worse. It occurred as I was creating my previous blog post. Ironically, I wanted to include a link to the HTML 5 specification. So in my first tab I had my blog open, and in the second tab I had the HTML 5 specification open.

I found the section on HTML video, selected the URL, and copied to the clipboard. When I returned to my blog page, Firefox completely locked up and I saw the spinning beach ball of death. I had to kill the process to regain control.

I repeated the above steps, and once again it completely locked up.

I finally managed to create that post, but only without the HTML 5 spec page open. So just now, while typing the previous paragraph, I again opened this URL.

And once again, Firefox became completely unresponsive, showing the beach ball for about 15-30 seconds.

It is mildly amusing that the one page that consistently brings Firefox 3.5 to its knees is the HTML 5 specification page.

One Problem with HTML Video

The HTML 5 video element is a move in the right direction, but it currently doesn’t work in Google Reader. Here is how a YouTube video looks in Reader:

This is on a Mac, using Firefox 3.5. Here is a blog containing the new HTML 5 video tag:

When I go to that blog, it works…just not in Reader.

State Capitals 1.0.2

I released State Capitals version 1.0.2 tonight. This is an Android flash-card app for U.S. State Capitals.

To find it, just go to the Android Market and search for “State Capitals”.

This release does not add any new features. Instead, I focused on:

  • Improved performance
  • Reduced memory allocation, resulting in less garbage collection
  • Smoother animation

The animation is the biggest visible change. In the old version, a fling gesture moved to the previous or next card. My approach was:

  1. Use a standard Android animation to slide the activity to the left or right, depending on whether you were moving to the next or previous card
  2. At this point, you’d see a black screen. This is where I loaded the next bitmap, and the garbage collector generally ran
  3. Use another animation to slide the activity back onto the screen. (with the new bitmap)

If you’ve used the app, you also know I spin the card around using an animation. Every time onDraw(…) was called, I’d paint the card border, the state bitmap, and the text on top of the state. This made the code very inefficient.

The New Approach

In the new version, you can slide your finger on the screen, and the card moves with your finger. You also see the previous or next card directly adjacent to the current card.

I also generate a bitmap for the entire screen, and cache that bitmap. So when an animation occurs, I simply paint the cached bitmap.

Finally, I eliminated many memory allocations. For example:

  • I only save your settings when onPause(…) occurs. Before, I was writing to preferences every time something changed, which resulted in large numbers of object allocations
  • I eliminated several Lists and Maps, replacing them with simple arrays
  • I reuse the same Bitmap and Canvas objects over and over

If you want to learn more, check out “Google I/O 2009 - Writing Real-Time Games for Android”.

My focus on reduced object allocation is a direct result of watching that video, and it made a huge improvement to my app.

Internet Explorer 8

Microsoft sure stirred up some controversy with this browser comparison chart. Here is a picture, because I suspect they’ll take down that page fairly soon.

As several people mentioned on Twitter, the chart fails to include Opera or Safari. Plus, most of the items are highly subjective. This is obviously a marketing document, not a scientific comparison. We get it.

Lack of Trust

When IE first arrived, it had to compete with Netscape. Once they crushed the competition, Microsoft slept. For five years. They released IE 6 in 2001, and IE 7 in 2006.

Lack of competition hurt our industry and stifled innovation. Because of those five years, a lot of us simply do not trust Microsoft when it comes to browsers.

Competition

Thank goodness for the people behind Firefox, Opera, Safari, Chrome, and probably other browsers that I’m not thinking of. It is perfectly clear that Microsoft is now focused on improving Internet Explorer through better security, performance, and even standards compliance.

Good for them. IE 8 is their best effort yet.

Good for us. Web standards are good for us all.

But…I am skeptical.

Fool me once, shame on you. Fool me twice, shame on me.

Those five years cannot be swept under the rug with one new product release. Microsoft needs to earn back our trust. It will be hard, but not impossible.

What I Want

I want all of these browsers to compete, and to focus on web standards. Supporting today’s standards are an important first step for Microsoft, and I applaud their efforts.

To make up for the years lost with IE 6, Microsoft needs to do a lot more to win back my trust. I want Microsoft to boldly lead the way toward HTML 5, including support for embedded video, the canvas tag, native drag-and-drop to the browser, and more.

This means making standards-based browsers that will directly compete with proprietary plug-ins like Silverlight and Flash. Browser lock-in is old school. Proprietary plug-ins are old school. This video shows what I expect from my browser:

It would be wonderful if I could embed that video with a simple tag, but for now, that’s impossible. I eagerly await the day when that ugly <object …><embed… type=”application/x-shockwave-flash”> …</embed></object> crap is a distant memory.

Swiss Codemonkey: Avoid Them

Last week I installed a goofy app “Arnold Soundboard for Android” from Swiss Codemonkeys. I shouldn’t have, because the app requested network access.

Today, I received what appeared to be an SMS message. It had a little “thumbs-up” icon, and it said something like “A friend recommended an app!”. Clicking on the link brought me to the Android Market link for the Horoscope Widget, also from Swiss Codemonkeys.

Malicious

I strongly suspect this message came from the Arnold Soundboard app, but I can’t really prove that. I did report it as a possible malicious app, and I recommend people avoid apps from Swiss Codemonkey. (or any other apps that request network access even when they don’t do anything network related).

If you are an application author, feel free to advertise your other apps. But don’t send messages pretending to be “recommendations” from alleged “friends”.

Android Device Database

By the end of 2009, Google predicts there will be at least 18 Android phones. This is great news, but it also means developers must create apps that work on a wide range of devices. Each phone may have a different screen resolution, support different sensors, and could report a different User Agent string when accessing web sites.

The Idea

Create an online, interactive Android device database. This web site will list every Android device, along with complete specifications. The site should use AJAX so visitors can sort, search, and filter efficiently. Using this site, people can see:

  • Detailed specifications for specific phones
  • Sort by screen size or any other attribute
  • Filter to show phone supporting the accelerometer or any other combination of features
  • Select several phones and compare their features side-by-side
  • etc…

Android Client Software

Part of this project involves a client application running on Android. This application will inspect all of the phone’s features and upload them automatically to the Android device database web site. For example:

  • Screen resolution
  • Keyboard type (physical or soft)
  • List of supported sensors
  • Software version information
  • OpenGL features
  • Anything else we can detect without violating user privacy…

This information is easy to gather, and can be POSTed to the web site as XML or JSON. Once submitted, the information is automatically entered into the phone database along with the User Agent the phone sent.

How I Would Do It

I don’t have time to create this app (I’m working on something else). If I did have time, here is how I’d do it:

  • GWT 1.6 for the web site
  • Google App Engine for the server hosting and data storage
  • Android SDK for the client (duh)
  • Google security to prompt for username/password when submitting a new report
  • Host everything on Google Code with an Apache 2.0 license
  • Use Mercurial for the source code

Moderation Queue

This is a technically easy project. The main challenge I anticipate is fighting bogus submissions and spam. You could implement a moderation queue for any new submissions. Once someone with a T-Mobile G1 submits the first report, all subsequent submissions from identical phones should be identical, and would thus be automatically ignored.

You may need to moderate and approve brand new submissions from phones that are not yet recorded in the database.

Other Ideas

It might be nice if people could post pictures of each phone on the web site. This would be a manual process, as the phone software cannot take a picture of itself.

So what do you think? Is anyone interested in creating this application?

Ominous New Direction for Java?

Java SE 6 Update 14 (gotta love those names) is now available. According to the release notes, a new “Garbage First (G1) Garbage Collector” is enabled. To use it:

-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC

Do so with caution, however. As @kimchy noted on Twitter, the release notes include this statement:

Although G1 is available for use in this release, note that production use of G1 is only permitted where a Java support contract has been purchased.

What do you think?

Google I/O Contest

Are you attending Google I/O? I’m not, but @davidangry is.

Submit your best @davidangry Google I/O story on Twitter. After the conference ends, the best Tweet wins a $20 Amazon gift certificate.

Rules

  • Your tweet must mention @davidangry (so I know how to find it)
  • Your tweet must include the #io2009 hash tag
  • I am the judge.

The contest is real. @davidangry is not. Let the tweeting begin.

House for Sale Fail

My redneck neighbors are trying to sell their house. Seriously.

The weeds are a nice touch, too.

Sprint Genius Bar

A friend of mine took this picture at one of the new Sprint Genius Bar clones, which Sprint calls Ready Now.

Nice try.