← Back to team overview

launchpad-dev team mailing list archive

Re: js timeout issues on ec2 due to deep js namespaces

 

On Thu, Sep 20, 2012 at 9:23 AM, Richard Harding
<rick.harding@xxxxxxxxxxxxx> wrote:
> On Thu, 20 Sep 2012, Gavin Panella wrote:
>
>> On 19 September 2012 14:25, Deryck Hodge <deryck.hodge@xxxxxxxxxxxxx> wrote:
>> > It's not just the assignment or lookup alone; there's also the
>> > performance hit for creating that namespace.  Also, that assignment
>> > hit has to be paid over and over in each test.  Every JavaScript book
>> > will note that nested properties are slow in every browser.  We've
>> > just been lazy about this.  Now we have definitive proof that it costs
>> > us something -- i.e. Rick had a test that failed due to a timeout
>> > error, due to these long namespaces.  So it makes sense to fix it now,
>> > or at least not make it worse going forward.
>>
>> I guess it's an interpreter problem, though Curtis says there's
>> massive improvements in WebKit since Lucid. I assume these problems
>> are being observed on post-Lucid machines?
>>
>> It seems unbelievable that four/five lookups should be so expensive,
>> especially compared to, say, manipulating the DOM, but I guess
>> JavaScript has the potential for prototype lookups too along the way.
>>
>> Do you know of any decent profilers that could incontrovertibly
>> confirm the root cause? I know you guys have shown that reducing
>> namespace lookups helps, but I'm still amazed that this is a problem,
>> and I don't know how else to silence my brain's WTF lobe.
>
> Gavin, I've not had a chance to dig into it a ton, but I did toss together
> a quick perf test to check browsers and their speed of dealing with nested
> namespaces.
>
> Check out this following url in various browsers.
>
> http://jsperf.com/js-object-lookup
>
> Below are screenshots of tests with Chrome dev version, FF nightly, and an
> IE test in a Virtualbox setup.
>
> Chrome: http://ubuntuone.com/4m2YYq3itkCaorK2DP4g2F
> Firefox: http://ubuntuone.com/1QlZSJOxWWCiHBDJrETdHu
> IE: http://ubuntuone.com/3ZEJ2yoTBapMPk01E6C3Wo
>
>
> You can see how FF and IE show a very scaled change as the namespace
> deepens. I can imagine a very old webkit showing this pattern and I'm sure
> as the namespace widens as well as deepens the lookup hit would be larger.
> I still don't think that in the limited JS code in use here it should have
> caused these timeouts, but that'll take more work to narrow down which
> lines were really killing me or the test runner.

That's pretty nice, Rick.  Thanks for putting that together.

Remember that our test runner is running a very old webkit as Curtis
notes, which is why we see the problem exacerbated in ec2 test.

Cheers,
deryck


-- 
Deryck Hodge
https://launchpad.net/~deryck
http://www.devurandom.org/


References