{"action":"created","issue":{"url":"https://api.github.com/repos/osteslag/Changeset/issues/3","labels_url":"https://api.github.com/repos/osteslag/Changeset/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/osteslag/Changeset/issues/3/comments","events_url":"https://api.github.com/repos/osteslag/Changeset/issues/3/events","html_url":"https://github.com/osteslag/Changeset/pull/3","id":124667903,"number":3,"title":"Minor Generic and Guard changes","user":{"login":"perlfly","id":6462966,"avatar_url":"https://avatars.githubusercontent.com/u/6462966?v=3","gravatar_id":"","url":"https://api.github.com/users/perlfly","html_url":"https://github.com/perlfly","followers_url":"https://api.github.com/users/perlfly/followers","following_url":"https://api.github.com/users/perlfly/following{/other_user}","gists_url":"https://api.github.com/users/perlfly/gists{/gist_id}","starred_url":"https://api.github.com/users/perlfly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/perlfly/subscriptions","organizations_url":"https://api.github.com/users/perlfly/orgs","repos_url":"https://api.github.com/users/perlfly/repos","events_url":"https://api.github.com/users/perlfly/events{/privacy}","received_events_url":"https://api.github.com/users/perlfly/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-03T20:01:45Z","updated_at":"2016-01-04T07:55:48Z","closed_at":"2016-01-04T07:33:23Z","pull_request":{"url":"https://api.github.com/repos/osteslag/Changeset/pulls/3","html_url":"https://github.com/osteslag/Changeset/pull/3","diff_url":"https://github.com/osteslag/Changeset/pull/3.diff","patch_url":"https://github.com/osteslag/Changeset/pull/3.patch"},"body":"Remove force cast to Int adding Generic constraint for CollectionType\r\nMove guard conditions in `editDistance` at the top of the function"},"comment":{"url":"https://api.github.com/repos/osteslag/Changeset/issues/comments/168605362","html_url":"https://github.com/osteslag/Changeset/pull/3#issuecomment-168605362","issue_url":"https://api.github.com/repos/osteslag/Changeset/issues/3","id":168605362,"user":{"login":"osteslag","id":62719,"avatar_url":"https://avatars.githubusercontent.com/u/62719?v=3","gravatar_id":"","url":"https://api.github.com/users/osteslag","html_url":"https://github.com/osteslag","followers_url":"https://api.github.com/users/osteslag/followers","following_url":"https://api.github.com/users/osteslag/following{/other_user}","gists_url":"https://api.github.com/users/osteslag/gists{/gist_id}","starred_url":"https://api.github.com/users/osteslag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osteslag/subscriptions","organizations_url":"https://api.github.com/users/osteslag/orgs","repos_url":"https://api.github.com/users/osteslag/repos","events_url":"https://api.github.com/users/osteslag/events{/privacy}","received_events_url":"https://api.github.com/users/osteslag/received_events","type":"User","site_admin":false},"created_at":"2016-01-04T07:55:48Z","updated_at":"2016-01-04T07:55:48Z","body":"While I’d definitely like to exit earlier, the value of the *only slightly* earlier exist was not justified by the duplicated code and marginal memory optimisation, in my opinion.\r\n\r\n[The `for` loops ](https://github.com/perlfly/Changeset/blob/1f585674e15ba7ac8df0308bd9b71d11c7eb6e8a/Changeset/Changeset.swift#L103-L114) come quite early – after the `d` allocation, yes, but it only allocates the amount of memory needed anyway. Just like your code.\r\n\r\nA much more relevant optimisation, I think, would be to make the [`Changeset.edits` property `lazy`](https://github.com/osteslag/Changeset/blob/9c28731d47cf837d05c5f487eb9b8f71e095f1aa/Changeset/Changeset.swift#L45-L48). The user may have a bunch of `Changeset` values in the air, and may only be querying the `edits` on some of those. It would be a waste to have computed the edit distances in those unused cases. But I haven’t found a way to do that in Swift 2."}}