← Back to team overview

launchpad-dev team mailing list archive

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


On Wed, Sep 19, 2012 at 5:37 AM, Gavin Panella
<gavin.panella@xxxxxxxxxxxxx> wrote:
> On 18 September 2012 18:51, Richard Harding <rick.harding@xxxxxxxxxxxxx> wrote:
> ...
>> var ns = Y.lp.registry.product.view;
> Why is doing this not enough? It seems that getting rid of nested
> namespaces is a fairly big piece of work in order to avoid best
> practice as above, i.e. simulating `from module import thing`.

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.

We don't have to come up with crazy or odd names, but I think we
should strive for as shallow as namespace as is reasonable.  Our js
code will be faster and we'll be certain we won't hit these test


Deryck Hodge

Follow ups