{"action":"created","issue":{"url":"https://api.github.com/repos/caolan/async/issues/1089","repository_url":"https://api.github.com/repos/caolan/async","labels_url":"https://api.github.com/repos/caolan/async/issues/1089/labels{/name}","comments_url":"https://api.github.com/repos/caolan/async/issues/1089/comments","events_url":"https://api.github.com/repos/caolan/async/issues/1089/events","html_url":"https://github.com/caolan/async/issues/1089","id":144220636,"number":1089,"title":"Allow to set `thisArg`","user":{"login":"piranna","id":532414,"avatar_url":"https://avatars.githubusercontent.com/u/532414?v=3","gravatar_id":"","url":"https://api.github.com/users/piranna","html_url":"https://github.com/piranna","followers_url":"https://api.github.com/users/piranna/followers","following_url":"https://api.github.com/users/piranna/following{/other_user}","gists_url":"https://api.github.com/users/piranna/gists{/gist_id}","starred_url":"https://api.github.com/users/piranna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piranna/subscriptions","organizations_url":"https://api.github.com/users/piranna/orgs","repos_url":"https://api.github.com/users/piranna/repos","events_url":"https://api.github.com/users/piranna/events{/privacy}","received_events_url":"https://api.github.com/users/piranna/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-29T10:15:44Z","updated_at":"2016-03-29T21:08:06Z","closed_at":null,"body":"Some Javascript Array functions (and others) allow to define a `thisArg` argument that allow to define the `this` object when the function gets executed, and it's specially useful to give them a context where to execute without needing to create new Function objects with `.bind()` but using instead `.apply()`, earning some memory and cpu."},"comment":{"url":"https://api.github.com/repos/caolan/async/issues/comments/203105545","html_url":"https://github.com/caolan/async/issues/1089#issuecomment-203105545","issue_url":"https://api.github.com/repos/caolan/async/issues/1089","id":203105545,"user":{"login":"aearly","id":558190,"avatar_url":"https://avatars.githubusercontent.com/u/558190?v=3","gravatar_id":"","url":"https://api.github.com/users/aearly","html_url":"https://github.com/aearly","followers_url":"https://api.github.com/users/aearly/followers","following_url":"https://api.github.com/users/aearly/following{/other_user}","gists_url":"https://api.github.com/users/aearly/gists{/gist_id}","starred_url":"https://api.github.com/users/aearly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aearly/subscriptions","organizations_url":"https://api.github.com/users/aearly/orgs","repos_url":"https://api.github.com/users/aearly/repos","events_url":"https://api.github.com/users/aearly/events{/privacy}","received_events_url":"https://api.github.com/users/aearly/received_events","type":"User","site_admin":false},"created_at":"2016-03-29T21:08:06Z","updated_at":"2016-03-29T21:08:06Z","body":"It was a deliberate design decision back in the day to leave `thisArg` management to the user.  Leaving it out definitely simplifies Async's internals.\r\n\r\nIn practice, there is negligible performance difference between using `.bind()`, `.apply()`, or using a closure.  While `.apply()` is slightly faster, any performance gain would probably be obviated by having to juggle around a `thisArg`."}}