since the use case is developer controlled, i just decided to leave it to
developers user to make safety checks when using complex multi-leveled
objects, while i check only the first level. with caching, this can be quite
fast, and i don't think much more complex arrays are gonna be used.

On Sat, Jun 12, 2010 at 6:57 PM, Oskar Krawczyk <[email protected]>wrote:

> Heh. Yeah.
>
> On 12 Jun 2010, at 16:40, Steve Onnis wrote:
>
>  and then if you are storing nested objects or arrays? good luck with that
> one
>
>  ------------------------------
> *From:* Oskar Krawczyk [mailto:[email protected]]
> *Sent:* Saturday, 12 June 2010 9:55 PM
> *To:* [email protected]
> *Subject:* Re: [Moo] Re: fastest way to check if 2 objects are equal
>
>  I never said it was.
>
> Bottom line: iterate through all key-values, and forget about performance
> issues.
>
> O.
>
>  On 12 Jun 2010, at 12:19, אריה גלזר wrote:
>
>  wont work. look here:
> http://jsfiddle.net/AZwgz/6/
> since you're not making any distinction between key and value, mixing them
> will give false positives, and this isn't a long-shot scenario.
>
> On Sat, Jun 12, 2010 at 12:19 PM, Oskar Krawczyk <[email protected]
> > wrote:
>
>>  This is kinda hardcore but still works:
>> http://jsfiddle.net/oskar/AZwgz/2/
>>
>> O.
>>
>>  On 12 Jun 2010, at 09:35, אריה גלזר wrote:
>>
>>  yep.
>>
>> but doing something that isn't order specific and infinite depth is
>> extremely expensive - i would need to go key-by-key, check if 2 objects have
>> them, and then check if they are objects and so on. this is a lot of work
>> for the browser for something that can happen quite a lot on my application
>> - to be more specific - 
>> HistoryManager<http://mootools.net/forge/p/historymanager>- where creating a 
>> noticeable delay is not an option. since he keys are JS
>> generated, i can assume that they are in the same order.
>>
>> On Sat, Jun 12, 2010 at 10:19 AM, amadeus <[email protected]>wrote:
>>
>>> Couldn't this cause some problems if the key:val pairs aren't written
>>> out in the same order?
>>>
>>> var obj1 = { cool:'sauce', abc:1 };
>>> var obj2 = { abc:1, cool:'sauce' };
>>>
>>> JSON.encode(obj1);
>>> // returns "{"cool":"sauce","abc":1}"
>>>
>>> JSON.encode(obj2);
>>> // returns "{"abc":1,"cool":"sauce"}"
>>>
>>> Even though technically speaking, they both have 'identical
>>> data' (whatever that means :) )
>>>
>>
>>
>>
>> --
>> Arieh Glazer
>> אריה גלזר
>> 052-5348-561
>> 5561
>>
>>
>>
>
>
> --
> Arieh Glazer
> אריה גלזר
> 052-5348-561
> 5561
>
>
>
>


-- 
Arieh Glazer
אריה גלזר
052-5348-561
5561

Reply via email to