satine.org

by Charles Ying

Archive for the ‘Life’ Category

WebKit, the New Linux

Tuesday, September 2nd, 2008

What do Apple, Google, Adobe, Nokia and RIM have in common?

WebKit.

WebKit is in iPhones, Android phones, Google Chrome, Mac OS X, Nokia S60, Blackberries, 2009 Palm Phones, and Adobe AIR. For every tech gadget that the blogosphere drools over, WebKit is there.

And more hotness is coming.

These companies are fierce mobile sector competitors. Yet they all use WebKit. Linux is the only thing that even comes close to such widespread adoption in this sector.

That’s a big deal.

Now take a look at the members of the Android Open Handset Alliance. These companies are a who’s who in the mobile sector. KDDI. DoCoMo. Samsung. Motorola. Qualcomm.

That’s a huge deal.

Why? WebKit is smallest, fastest, simplest, and it’s an easily hackable browser kernel.

(Does that mean WebKit is the iPhone killer? (Wait a sec…))

And Google is about to contribute stuff to make it even faster. Gotta love that open source.

As for WebKit’s competitors?

Definitely Opera for now. Opera is a mobile juggernaut.

Perhaps Mozilla, once they have a browser core that’s small and simple enough.

I still have hope. The Mobile Web Wars would be pretty boring otherwise. ;-)

Technorati Tags: , , , , , , ,

SquirrelFish is faster than Tamarin

Tuesday, June 3rd, 2008

WebKit and Tamarin Comparison

Smaller bars are better.

Wow.

I compared WebKit’s new SquirrelFish bytecode JavaScript interpreter against Tamarin, the JIT JavaScript engine currently in Flash 9 and in development for Firefox.

On the SunSpider JavaScript benchmark, SquirrelFish is at least 1.9 times faster than Tamarin with tracing turned on; 1.8 times faster than vanilla Tamarin, the same engine used in Flash 9. When you add type annotations to Tamarin (SquirrelFish doesn’t support them), Tamarin gets a little faster, but is still slower than SquirrelFish on these benchmarks.

Keep in mind, SquirrelFish’s reported times include source compilation, while Tamarin is executing pre-compiled bytecode outside the test.

First Impressions

  1. I can imagine the “performance per watt” power consumption for SquirrelFish is also much lower. Good for my iPhone’s battery life.
  2. I think I’m wrong about the importance of JITs. At least until SquirrelFish has gone through a few rounds of optimizations.
  3. ECMAScript 4 type annotations can clearly help in performance critical code, but most of the web executes in untyped, vanilla JavaScript.

Notes on my tests: Running SunSpider, tamarin-tracing, tamarin-central, and SquirrelFish all pulled from source on 2008-06-02. I ran the test on a 2.4 Ghz iMac. Raw numbers from the comparison runs are available here.

Running your own version of the tests

To reproduce these tests, build WebKit, build tamarin-tracing and tamarin-central from Mozilla.org, and install the Flex SDK for a bytecode compiler. Then,

  1. Set up your environment as follows: DYLDFRAMEWORKPATH="~/jsbench/WebKit/WebKitBuild/Release" ASC="~/jsbench/asc.jar" GLOBALABC="~/jsbench/tamarin-tracing/core/builtin_full.abc"
  2. Create a “timer.js” file that adds getTimer to the SunSpider benchmark: function getTimer() { return new Date(); }
  3. Create a “jscore” script that will run the original SunSpider AS source files instead of the ABC bytecode files: #!/bin/sh ~/jsbench/WebKit/WebKitBuild/Release/testkjs -f ~/jsbench/timer.js -f echo $1 | sed s/abc/as/
  4. And call the runtests.py script in the SunSpider test/performance sub-directory: ./runtests.py --avm ~/research/jsbench/jscore --avm2 ~/research/jsbench/tracing-avmshell ./runtests.py --avm ~/research/jsbench/jscore --avm2 ~/research/jsbench/central-avmshell

Technorati Tags: , , , , ,

What You Need To Know About Amazon SimpleDB

Thursday, December 13th, 2007

Well after being under NDA for so long, I’m glad to be able to say that Amazon SimpleDB has gone into limited beta. Congratulations to everyone on the SDS / SimpleDB team; their several years of work on SimpleDB (formerly called SDS) is a brilliant piece of engineering.

What’s cool about SimpleDB

  • Really large data sets
  • Really Fast
  • Highly Available – It’s Amazon. Running Erlang. Whoa.
  • On demand scaling – Like S3, EC2, with a sensible data metering pricing model
  • Schemaless – major cool factor for me here; items are little hash tables containing sets of key, value pairs

Considerations you’ll want to think about

  • Eventual Consistency – Data is not immediately propagated across all nodes… the latency is usually around a second, but for high data sets or loads, you may experience more latency. On the plus side, your data isn’t lost!
  • Queries are lexigraphical – You’ll need to store data in lexicographical ordered form (zero-pad your integers, add positive offsets to negative integer sets, and convert dates into something like ISO 8601)
  • Search Indexes – You’ll need to construct your own indexes for text search – The SimpleDB query expressions don’t support text search, so you’ll have to construct inverted indexes to properly do “text search”. This is actually a really great lightweight way to do this and I’m sure many interesting indexing schemes will be possible.

Under the hood

According to the SimpleDB team, SimpleDB is built on top of Erlang. One of the developers, Jim Larson and I worked together at Sendmail, and he was part of a team doing some amazing stuff with an Erlang message store way back in 2000.

While you don’t need to know Erlang to use SimpleDB, many people have visited here interested in its Erlang roots. If you are interested in learning Erlang, I can recommend Programming Erlang, written by Erlang’s creator – the best introduction you can find. I’ve associate-linked to it on Amazon; just for a little meta-fun.

The data model is simply:

  • Large collections of items organized into domains.
  • Items are little hash tables containing attributes of key, value pairs.
  • Attributes can be searched with various lexicographical queries.

Now you can easily build:

  • Search indexes
  • Log databases / analysis tools –
  • Data mining stores
  • Tools for World Domination

Further Reading

I also wrote a very basic Python module for SimpleDB to handle the XML and REST stuff (too bad it’s not JSON, at least for now), which I’ll release as soon as I figure out how much of the NDA is now lifted. There are a few floating around, so it shouldn’t be too long before they appear publicly.

Updates:

  • Added a link to Nick Christenson‘s paper on Sendmail’s Erlang message store – A great read for those of you building large scale messaging systems or anything in Erlang.
  • Added a link to Werner Vogels’ article on eventual consistency – a great background behind SimpleDB’s consistency design choice.
  • Whether or not SimpleDB and Dynamo are the same underlying technology has never been confirmed by an authoritative source. That’s all I’m allowed to say.

Technorati Tags: , , , ,