HTML5 Storage – Odd Performance Numbers

Fête de l'automobile_0058
Creative Commons License photo credit: bienvu

I've been working on a GWT application that makes use of HTML5 local storage to persist state between loads. The target for right now is the iPad and the two webkit browsers -- Chrome and Safari.

I wasn't all that happy with the speed of the local hash storage, so I decided to test out the db versus hash performance. First off was writing. After coding up a quick benchmark and storing 20,000 key-value pairs in both the hash and a db table, I had some really odd numbers:

  • Mobile Webkit (on the iPad): 0.96 seconds for the hash, 1.24 seconds for the database
  • Chrome 5.0 (Mac): 18.39 (!!) seconds for the hash, 0.31 seconds for the database
  • Safari 5.0 (Mac): 0.05 seconds for the hash, 0.17 seconds for the database

What stands out here is the slow performance of Chrome. I'm going to try and do this in vanilla JavaScript, just to take GWT out of the equation. I hope that's what it is, otherwise this looks like a Chrome bug.