On Wed, Oct 15, 2008 at 13:37, Per Cederberg <[EMAIL PROTECTED]> wrote:
> On Wed, Oct 15, 2008 at 1:01 PM, Arnar Birgisson <[EMAIL PROTECTED]> wrote:
>> Done. Yup, the number of nodes is not correct (or at least as correct
>> as th other frameworks). Performance takes a minor hit, mainly because
>> it is so bad to begin with :)
>
> Ah, you mean "now correct"... :-)
Heh, yes - I do :) I think I left my typing fu in Iceland.
> Disturbing that this fix actually affects performance in a noticable
> way. It really shouldn't, except when more than ~100 elements are
> matched. Perhaps there are some obvious improvements to be made in my
> uniq() implementation:
>
> var uniq = function(arr) {
> var res = [];
> for (var i = 0; i < arr.length; i++) {
> if (MochiKit.Base.findIdentical(res, arr[i]) < 0) {
> res.push(arr[i]);
> }
> }
> return res;
> };
>
> I think the above should be O(n^2). Not optimal, but fixing the root
> cause means rewriting the module altogether. :-(
We should definitely not invest in a big rewrite at this point. As for
the uniq, this is probably as good as it gets unless we can assume
that identical items are always consecutive. If they are, there's the
obvious O(n) method of course.
> Many thanks for your help, Arnar!
You are the one that deserves thanks for your efforts :)
cheers,
Arnar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---