Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimized isEqual function, 30x faster on integers #2179

Closed
wants to merge 3 commits into from

Conversation

gaperton
Copy link

and 1,5 times faster than lodash.isEqual
http://jsperf.com/underscore-isequal/3

@gaperton
Copy link
Author

Some problems in unit tests. Next time then.

@gaperton gaperton closed this May 16, 2015
var typeA = typeof a;
if( typeA != typeof b ) return false;
if( typeA == 'object' ) return a && b ? eq( a, b ) : a === b;
return a != a ? b != b : a === b;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't move this code so [NaN] == [NaN] (recursive cases)

@gaperton
Copy link
Author

Unfortunately, this code doesn't work at all breaking underscore unit tests, so I noticed that and cancelled this pull request. :)

I've prepared different implementation. Which appears to be correct, and it's faster. Check it out. Performance is terrific.

#2180

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants