From: Garrett Smith on
Jorge wrote:
> On Jan 5, 8:07 am, Garrett Smith <dhtmlkitc...(a)gmail.com> wrote:
>> (...)
>> Accessing properties off the global object is slower than accessing
>> properties off a user defined object.
>>
>> Access property off global object:
>> (...)
>> Access property off user-defined object:
>> (...)
>
> OMG. What are you saying ?

Accessing properties off the global object is slower than accessing
properties off a user defined object.

What is confusing about that?
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/
From: Garrett Smith on
Jorge wrote:
> On Jan 5, 9:23 am, Jorge <jo...(a)jorgechamorro.com> wrote:
>> On Jan 5, 8:07 am, Garrett Smith <dhtmlkitc...(a)gmail.com> wrote:
>>
>>> (...)
>>> Accessing properties off the global object is slower than accessing
>>> properties off a user defined object.
>>> Access property off global object:
>>> (...)
>>> Access property off user-defined object:
>>> (...)
>> OMG. What are you saying ?
>
> I mean, the code snippets that you've posted are comparing access time
> to an identifier at the end of the scope chain (a global) versus an
> identifier in the first link (a local var). That has nothing to do
> with whether the object is or isn't "user defined".


Which identifier at the end of the scope chain?

Here is the example one more time:

| Access property off global object:
| (function(){
| var p = window;
| var d = new Date;
| for(var i = 0; i < 10000; i++)
| p["d" + ".b" + i + ".c.d"] = i;
| return new Date-d;
| }())
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/
From: John G Harris on
On Mon, 4 Jan 2010 at 13:16:18, in comp.lang.javascript, Dmitry A.
Soshnikov wrote:
>On 4 0 >> On Sun, 3 Jan 2010 at 10:18:43, in comp.lang.javascript, Dmitry A.
>>
>> Soshnikov wrote:
>> >On 3 0
>> <snip>
>> >> You could have quoted like this :
>>
>> >> >> In a Web page, it's generally a terrible idea
>>
>> >> <your complaint about 'terrible'>
>>
>> >I know that, thanks.
>>
>> If you know that then why did you make it look as though David wrote the
>> word 'terrible' four times ?
>>
>
>I've already answered to you. Should I repeat twice? Please ask if
>something still unclear, I will.

You said it was ironical. You still haven't said why you used quote
markers to make it look like David wrote something four times in his
article. That's forgery, as an aid to demagogy.

John
--
John Harris
From: Garrett Smith on
Thomas 'PointedEars' Lahn wrote:
> Garrett Smith wrote:
>
>> Jorge wrote:
>>> On Jan 5, 8:07 am, Garrett Smith <dhtmlkitc...(a)gmail.com> wrote:
>>>> (...)
>>>> Accessing properties off the global object is slower than accessing
>>>> properties off a user defined object.
>>>>
>>>> Access property off global object:
>>>> (...)
>>>> Access property off user-defined object:
>>>> (...)
>>> OMG. What are you saying ?
>> Accessing properties off the global object is slower than accessing
>> properties off a user defined object.
>>
>> What is confusing about that?
>
> The statement is gibberish

It's a question, not a statement.


>
> As a result, accessing the global object directly (with `this' where the
> `this' value is fitting) is actually *faster* than accessing the user-
> defined object if the user-defined object is being referred to by a
> property of the global object (and it cannot get any higher in the
> aggregation tree than that), because one property access less (i.e., none)
> is necessary then.
>

The example code is not using `this` because it makes no sense. o you
have criticism for the example code or ?

> That said, in your example code (hopefully not also in APE) you are not
> even accessing the global object but a poor substitute for it, a host
> object that either mirrors the global object's properties or (more likely)
> has the global object in its prototype chain. So you are not exactly in a
> position to lecture anyone about "accessing properties off global object",
> whatever that gibberish is supposed to mean.
>

I'm not interested in having discussion with one who calls gibberish and
reads questions as statements and certainly not interested your
fantasies about me being in positions.
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/
From: Jorge on
On Jan 5, 7:58 pm, Garrett Smith <dhtmlkitc...(a)gmail.com> wrote:
> Jorge wrote:
> > On Jan 5, 9:23 am, Jorge <jo...(a)jorgechamorro.com> wrote:
> >> On Jan 5, 8:07 am, Garrett Smith <dhtmlkitc...(a)gmail.com> wrote:
>
> >>> (...)
> >>> Accessing properties off the global object is slower than accessing
> >>> properties off a user defined object.
> >>> Access property off global object:
> >>> (...)
> >>> Access property off user-defined object:
> >>> (...)
> >> OMG. What are you saying ?
>
> > I mean, the code snippets that you've posted are comparing access time
> > to an identifier at the end of the scope chain (a global) versus an
> > identifier in the first link (a local var). That has nothing to do
> > with whether the object is or isn't "user defined".
>
> Which identifier at the end of the scope chain?
>
> Here is the example one more time:
>
> | Access property off global object:
> | (function(){
> |   var p = window;
> |   var d = new Date;
> |   for(var i = 0; i < 10000; i++)
> |     p["d" + ".b" + i + ".c.d"] = i;
> |   return new Date-d;
> | }())

Ok, Garret, excuse me. I misread the code.
Yes, accessing window seems to take slightly longer than accessing {}.
I hope you're aware that p["d.bX.c.d"] has nothing to do with
p.d.bX.c.d, yes ?
--
Jorge.