{"action":"created","issue":{"url":"https://api.github.com/repos/jashkenas/underscore/issues/2496","repository_url":"https://api.github.com/repos/jashkenas/underscore","labels_url":"https://api.github.com/repos/jashkenas/underscore/issues/2496/labels{/name}","comments_url":"https://api.github.com/repos/jashkenas/underscore/issues/2496/comments","events_url":"https://api.github.com/repos/jashkenas/underscore/issues/2496/events","html_url":"https://github.com/jashkenas/underscore/pull/2496","id":148059517,"number":2496,"title":"Optimization of _.isNaN","user":{"login":"marijaselakovic","id":7926726,"avatar_url":"https://avatars.githubusercontent.com/u/7926726?v=3","gravatar_id":"","url":"https://api.github.com/users/marijaselakovic","html_url":"https://github.com/marijaselakovic","followers_url":"https://api.github.com/users/marijaselakovic/followers","following_url":"https://api.github.com/users/marijaselakovic/following{/other_user}","gists_url":"https://api.github.com/users/marijaselakovic/gists{/gist_id}","starred_url":"https://api.github.com/users/marijaselakovic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marijaselakovic/subscriptions","organizations_url":"https://api.github.com/users/marijaselakovic/orgs","repos_url":"https://api.github.com/users/marijaselakovic/repos","events_url":"https://api.github.com/users/marijaselakovic/events{/privacy}","received_events_url":"https://api.github.com/users/marijaselakovic/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-04-13T13:20:20Z","updated_at":"2016-04-13T13:45:41Z","closed_at":"2016-04-13T13:34:58Z","pull_request":{"url":"https://api.github.com/repos/jashkenas/underscore/pulls/2496","html_url":"https://github.com/jashkenas/underscore/pull/2496","diff_url":"https://github.com/jashkenas/underscore/pull/2496.diff","patch_url":"https://github.com/jashkenas/underscore/pull/2496.patch"},"body":"You might consider optimizing _.isNaN function  by changing the order in which checks are executed.  I run all tests and observed that isNaN(obj) is false for most of cases. By putting isNaN(obj) to be checked first, every time when it is false, the time spent in _.isNumber(obj) is saved. \r\n\r\nBy swapping checks, I got the following performance improvements on V8 engine:\r\nTest: isNaN - 38%\r\nTest: indexof with NaN - 46,37% \r\nTest: last indexof with NaN  - 23% \r\nTest: includes with NaN - 61,73% \r\n\r\nEven though this is a simple change, it seems to improve performance without affecting the readability of the code."},"comment":{"url":"https://api.github.com/repos/jashkenas/underscore/issues/comments/209447043","html_url":"https://github.com/jashkenas/underscore/pull/2496#issuecomment-209447043","issue_url":"https://api.github.com/repos/jashkenas/underscore/issues/2496","id":209447043,"user":{"login":"michaelficarra","id":218840,"avatar_url":"https://avatars.githubusercontent.com/u/218840?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelficarra","html_url":"https://github.com/michaelficarra","followers_url":"https://api.github.com/users/michaelficarra/followers","following_url":"https://api.github.com/users/michaelficarra/following{/other_user}","gists_url":"https://api.github.com/users/michaelficarra/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelficarra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelficarra/subscriptions","organizations_url":"https://api.github.com/users/michaelficarra/orgs","repos_url":"https://api.github.com/users/michaelficarra/repos","events_url":"https://api.github.com/users/michaelficarra/events{/privacy}","received_events_url":"https://api.github.com/users/michaelficarra/received_events","type":"User","site_admin":false},"created_at":"2016-04-13T13:45:41Z","updated_at":"2016-04-13T13:45:41Z","body":"I would've liked to have seen the benchmark data before merging this."}}