v0.2 in beta

2 views
Skip to first unread message

Peter Michaux

unread,
Jul 30, 2008, 2:44:12 PM7/30/08
to Fork JavaScript
Everything except the drag and drop code is now in beta for version
0.2. All of the following files load up without error and work in some
superficial tests in at least Firefox This means the new APIs are all
in place but still may change. It doesn't mean the code is finished.

featureTesting.js
event.js
find.js
json.js
cookie.js
dom.js
mutate.js
subject.js
xhr.js
opacity.js
scroll.js
eventPosition.js

If you want to checkout the code to read or experiment with the
feature testing style of programming it supports you can follow the
instructions here

http://dev.forkjavascript.org/trac

---------

Since the code is now beta is a good time to report problems. I've
clean the spam off the Fork Trac tickets.

http://dev.forkjavascript.org/trac/report/9

If you would like to be able to create tickets please send me a
private email (not to the group!) with your preferred username and
password.

Peter

RobG

unread,
Aug 4, 2008, 1:52:57 AM8/4/08
to Fork JavaScript


On Jul 31, 4:44 am, Peter Michaux <petermich...@gmail.com> wrote:
> Everything except the drag and drop code is now in beta for version
> 0.2.

[...]

> If you would like to be able to create tickets please send me a
> private email (not to the group!) with your preferred username and
> password.

Not sure I want to create tickets, but would like to be able to
comment. For example, in FORK.dom.addClass there is:

el.className = [el.className, className].join(' ');

I presume that is in resopnse to IE's poor string concatentation
performance with the += compound operator. I recently installed
IE8b1, so I can't test IE 6 or 7 any more (well, not easily), but
apparently MS have done quite a bit to fix IE's string concatenation
issues.

A test (see below) shows that it is twice as fast in IE8 to use +=
than [].join(). In Firefox, += is 70 to 80 times faster ([].join is
very slow). In Safari (Windows) they are about the same, but still
better than 10 times faster than IE8.

Given the rather large performance benefit of += in the above cases, I
suggest you move to that instead of [].join unless there is some other
browser where the benefit is substantial and you really care about
it. :-)

Test code:

var a = 'fred';
var b = '';
var i = 0;
var n = 10000;
var s0 = new Date();
var s1, f0, f1;

while (i++ < n) { b += ' ' + a; }

f0 = new Date();
i=0; b='';
s1 = new Date();

while (i++ < n) { b = [b, a].join(' '); }

f1 = new Date();
alert( '+= : ' + (f0 - s0)
+ '\n[] : ' + (f1 - s1)
);

Results (10,000 iterations):

Browser += [].join
IE8 170 375
Fx 8 650
Safari 15 15



--
Rob

Peter Michaux

unread,
Aug 12, 2008, 12:21:47 PM8/12/08
to forkjav...@googlegroups.com
Hi Rob,

On Sun, Aug 3, 2008 at 10:52 PM, RobG <rg...@iinet.net.au> wrote:
>
> On Jul 31, 4:44 am, Peter Michaux <petermich...@gmail.com> wrote:
>> Everything except the drag and drop code is now in beta for version
>> 0.2.
>
> [...]
>
>> If you would like to be able to create tickets please send me a
>> private email (not to the group!) with your preferred username and
>> password.
>
> Not sure I want to create tickets, but would like to be able to
> comment.

Certainly welcome.


> For example, in FORK.dom.addClass there is:
>
> el.className = [el.className, className].join(' ');
>
> I presume that is in resopnse to IE's poor string concatentation
> performance with the += compound operator. I recently installed
> IE8b1, so I can't test IE 6 or 7 any more (well, not easily), but
> apparently MS have done quite a bit to fix IE's string concatenation
> issues.

[snip test results]

Thanks for the info. I just sat down to make this change and when I
looked it, the use of join was already gone from the v0.2 beta code. I
had changed to the following so that there was no need to feature test
for join

el.className = el.className + ' ' + className;

It is now

el.className += ' ' + className;

Peter

Reply all
Reply to author
Forward
0 new messages