/dev/null

Elite is stupid. Back to the roots.

September 7, 2009

Object property ordering in Google Chrome

Tags: , , , , — 00:26

Today, I prepared for the upcoming PHP/JS conferences and had a look at the mysterious bug #883 of Google Chrome and those related to it. Also I read though SquirrelFish source, which is used by Safari 4.

The reason for the odd behavior of Chrome seems to be a if/else construct that is repeated throughout the source of runtime.cc:

// Check if the name is trivially convertible to an index and get
// the element if so.
if (name->AsArrayIndex(&index)) {
return GetElementOrCharAt(object, index);
} else {
PropertyAttributes attr;
return object->GetProperty(*name, &attr);
}

Chrome makes a difference between properties and elements. And they do weird type casts. If you check JavaScriptCore, you see there is a better way:

inline JSValue JSObject::get(ExecState* exec, const Identifier& propertyName) const
{
PropertySlot slot(this);
if (const_cast(this)->getPropertySlot(exec, propertyName, slot))
return slot.getValue(exec, propertyName);

return jsUndefined();
}

May 8, 2008

Safari rocks!

Tags: , , — 18:56

I forgot to mention why I had to install Privoxy (see my last post): Because I started using Safari, which doesn’t care about my privacy and security in the same way as Firefox does. Sadly, Firefox crashes every couple of minutes since the last update. Another reason for using Safari is it’s JavaScript performance:

uery, YUI and Dojo JS selector performance

The results show the final time in ms for the tests on http://www.domassistant.com/slickspeed/.

I’ve also done the same test on my Linux notebook (which is of course a bit slower than the 64bit Windows XP workstation) with Opera, Epiphany and Firefox:

JavaScript performance of Firefox, Opera and Epiphany

Still, the Webkit engine is the fastest! So go and try for yourself.

Powered by PHP, Memcached, Suhosin, MySQL and WordPress