{"action":"created","issue":{"url":"https://api.github.com/repos/astropy/astropy/issues/4479","labels_url":"https://api.github.com/repos/astropy/astropy/issues/4479/labels{/name}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/4479/comments","events_url":"https://api.github.com/repos/astropy/astropy/issues/4479/events","html_url":"https://github.com/astropy/astropy/pull/4479","id":126203589,"number":4479,"title":"Convolution speedup","user":{"login":"MSeifert04","id":14200878,"avatar_url":"https://avatars.githubusercontent.com/u/14200878?v=3","gravatar_id":"","url":"https://api.github.com/users/MSeifert04","html_url":"https://github.com/MSeifert04","followers_url":"https://api.github.com/users/MSeifert04/followers","following_url":"https://api.github.com/users/MSeifert04/following{/other_user}","gists_url":"https://api.github.com/users/MSeifert04/gists{/gist_id}","starred_url":"https://api.github.com/users/MSeifert04/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MSeifert04/subscriptions","organizations_url":"https://api.github.com/users/MSeifert04/orgs","repos_url":"https://api.github.com/users/MSeifert04/repos","events_url":"https://api.github.com/users/MSeifert04/events{/privacy}","received_events_url":"https://api.github.com/users/MSeifert04/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/astropy/astropy/labels/Affects-dev","name":"Affects-dev","color":"eb6420"},{"url":"https://api.github.com/repos/astropy/astropy/labels/convolution","name":"convolution","color":"c7def8"},{"url":"https://api.github.com/repos/astropy/astropy/labels/Performance","name":"Performance","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-01-12T15:26:24Z","updated_at":"2016-01-12T22:27:36Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/astropy/astropy/pulls/4479","html_url":"https://github.com/astropy/astropy/pull/4479","diff_url":"https://github.com/astropy/astropy/pull/4479.diff","patch_url":"https://github.com/astropy/astropy/pull/4479.patch"},"body":"Today I found out that convolution is slower than it needs to be.\r\n\r\nSimply moving the calculations to outer loops resulted in a speedup of around 50% for large arrays and even more for large kernels. For a 1000x1000 array with a 13x13 kernel this decreased the total execution time on my computer from 4.8 seconds to 2.1 seconds. For a small array 10x10 with a 3x3 kernel the speedup was not visible (actually it took a bit longer: 194 microseconds to new version with 201 microseconds).\r\n\r\nActually I'm not too familiar with cython but probably defining types for the calculations I moved may further increase the execution time.\r\n\r\nBut it would be nice if anyone else could confirm the speedup since I've had a bit of trouble with cython and maybe the dev-installation compiled in a different way and that's the only thing visible."},"comment":{"url":"https://api.github.com/repos/astropy/astropy/issues/comments/171080242","html_url":"https://github.com/astropy/astropy/pull/4479#issuecomment-171080242","issue_url":"https://api.github.com/repos/astropy/astropy/issues/4479","id":171080242,"user":{"login":"MSeifert04","id":14200878,"avatar_url":"https://avatars.githubusercontent.com/u/14200878?v=3","gravatar_id":"","url":"https://api.github.com/users/MSeifert04","html_url":"https://github.com/MSeifert04","followers_url":"https://api.github.com/users/MSeifert04/followers","following_url":"https://api.github.com/users/MSeifert04/following{/other_user}","gists_url":"https://api.github.com/users/MSeifert04/gists{/gist_id}","starred_url":"https://api.github.com/users/MSeifert04/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MSeifert04/subscriptions","organizations_url":"https://api.github.com/users/MSeifert04/orgs","repos_url":"https://api.github.com/users/MSeifert04/repos","events_url":"https://api.github.com/users/MSeifert04/events{/privacy}","received_events_url":"https://api.github.com/users/MSeifert04/received_events","type":"User","site_admin":false},"created_at":"2016-01-12T22:27:36Z","updated_at":"2016-01-12T22:27:36Z","body":"I'm not quite sure for the last commit if it is necessary to define\r\n\r\n``cdef unsigned int iii2``\r\n\r\nif one calulcates it as\r\n\r\n``iii2 = <unsigned int)(...)``\r\n\r\nI'm pretty inexperienced with Cython in this regard."}}