From: Thomas 'PointedEars' Lahn on
Garrett Smith replied to a cancelled and deleted posting.
From: Jorge on
On Jan 5, 2:55 am, Garrett Smith <dhtmlkitc...(a)gmail.com> wrote:
>
> Apple lies to the consumers about the technology.

Could you please elaborate ?

> Makes a web-incompatible browser

Which is ... ?

> patents the incompatibility

You probably mean the touch/gestures iPhone JS API ?

> prevents other
> browser competition on iPhone.

Here's a thought: design from scratch, build and try to sell your own
"smartphone". Then allow your competitors to put their software in
(Flash comes to my mind) so that you risk loosing control over your
own invention. Bright idea, yeah.

> The word "advertisement" comes from latin. The root word "advertise"
> means "turn toward".

And the saying think before you talk means exactly what it says.
Cheers,
--
Jorge.
From: Garrett Smith on
Jorge wrote:
> 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.

I though so.

The only global identifier is `Date`, but that exists in both cases.
Regardless, aliasing `Date` locally makes sense.

> 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 ?

You're right. The property is weird.

The reason for using that weird property name is have a fair comparison
on a level field with speed test for the namespace function. The same
name property assignment was copied from the other tests.

Testing property access using no concatenation would read simpler, and
would test purely property access speed, but would not compare as well
to the `namespace` tests, which use some concatenation.

The test for the namespace function uses a long concatenation, and so I
used the exact same string.

A more pure property-access test would not perform any string concatenation.
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/
From: Thomas 'PointedEars' Lahn on
Garrett Smith wrote:

> Jorge wrote:
>> 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.
>
> I though so.
>
> The only global identifier is `Date`,

No, `window' is supposed to be a property of the global object, too.

>> 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 ?
>
> You're right. The property is weird.
>
> The reason for using that weird property name is have a fair comparison
> on a level field with speed test for the namespace function. The same
> name property assignment was copied from the other tests.

The comparison is _not_ fair because `window' is not a (safe) reference to
the global object.

I had only cancelled my follow-up (that you had replied to anyway two hours
later) because I observed, to my surprise, that `this' referring to the
global object was (about 50%) slower than `global' where `global' was a
property of the global object (even if it stored a reference to the global
object) in Firebug (to which might the difference might be attributed; I
would set up a Firebug-unrelated test case then).

The rest of my points still apply for other cases than this: What matters
here is _not_ whether the object-referring property is one of the global
object but in how deep an execution context it is used (i.e., the length of
the effective scope chain) and how many property accesses are necessary to
retrieve the reference (i.e., the number of components -- and maybe the
length of the expression, too, considering how hash tables work -- in the
property accessor expression).


PointedEars
--
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
-- Richard Cornford, cljs, <cife6q$253$1$8300dec7(a)news.demon.co.uk> (2004)
From: Jorge on
On Jan 5, 11:56 pm, Jorge <jo...(a)jorgechamorro.com> wrote:
>
> Here's a thought: design from scratch, build and try to sell your own
> "smartphone". Then allow your competitors to put their software in
> (Flash comes to my mind) so that you risk loosing control over your
> own invention. Bright idea, yeah.

You ought to see what Larry Ellison says near the end (-5m40s) of the
2nd chapter of "the triumph of the nerds" about the "single worst
mistake in history" IBM did with regards to the PC. Really.
--
Jorge.