{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/11685","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/11685/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/11685/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/11685/events","html_url":"https://github.com/JuliaLang/julia/pull/11685","id":87774046,"number":11685,"title":"Performance improvements for sparse triu!, tril!, dropzeros!, droptol! ","user":{"login":"KristofferC","id":1282691,"avatar_url":"https://avatars.githubusercontent.com/u/1282691?v=3","gravatar_id":"","url":"https://api.github.com/users/KristofferC","html_url":"https://github.com/KristofferC","followers_url":"https://api.github.com/users/KristofferC/followers","following_url":"https://api.github.com/users/KristofferC/following{/other_user}","gists_url":"https://api.github.com/users/KristofferC/gists{/gist_id}","starred_url":"https://api.github.com/users/KristofferC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KristofferC/subscriptions","organizations_url":"https://api.github.com/users/KristofferC/orgs","repos_url":"https://api.github.com/users/KristofferC/repos","events_url":"https://api.github.com/users/KristofferC/events{/privacy}","received_events_url":"https://api.github.com/users/KristofferC/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-12T16:07:26Z","updated_at":"2015-06-12T18:03:34Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/11685","html_url":"https://github.com/JuliaLang/julia/pull/11685","diff_url":"https://github.com/JuliaLang/julia/pull/11685.diff","patch_url":"https://github.com/JuliaLang/julia/pull/11685.patch"},"body":"This changes the anonymous functions used in the calls to `fkeep!` made by `droptol!`, `dropzeros!`, `triu!` and `tril!` to instead use functors.\r\n\r\nPerformance differences below are with this benchmark:\r\n\r\n```julia\r\nA = sprand(10^5, 10^5, 0.001)\r\nB = copy(A)\r\n\r\nimport Base.droptol!\r\nimport Base.dropzeros!\r\n\r\nB = copy(A);\r\n@time droptol!(B, 0.1);\r\n\r\nB = copy(A);\r\n@time dropzeros!(B);\r\n\r\nB = copy(A);\r\n@time triu!(B);\r\n\r\nB = copy(A);\r\n@time tril!(B);\r\n```\r\n\r\n## Master\r\n```julia\r\n 605.263 milliseconds (49914 k allocations: 762 MB, 7.72% gc time)\r\n 422.887 milliseconds (29908 k allocations: 456 MB, 8.26% gc time)\r\n 376.937 milliseconds (29908 k allocations: 456 MB, 9.14% gc time)\r\n 374.099 milliseconds (29908 k allocations: 456 MB, 9.38% gc time)\r\n```\r\n\r\n## PR\r\n```julia\r\n  32.674 milliseconds (4 allocations: 144 bytes)\r\n  31.266 milliseconds (4 allocations: 144 bytes)\r\n  26.735 milliseconds (38 allocations: 2416 bytes)\r\n  27.053 milliseconds (38 allocations: 2416 bytes)\r\n```"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/111576485","html_url":"https://github.com/JuliaLang/julia/pull/11685#issuecomment-111576485","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/11685","id":111576485,"user":{"login":"dmbates","id":371258,"avatar_url":"https://avatars.githubusercontent.com/u/371258?v=3","gravatar_id":"","url":"https://api.github.com/users/dmbates","html_url":"https://github.com/dmbates","followers_url":"https://api.github.com/users/dmbates/followers","following_url":"https://api.github.com/users/dmbates/following{/other_user}","gists_url":"https://api.github.com/users/dmbates/gists{/gist_id}","starred_url":"https://api.github.com/users/dmbates/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmbates/subscriptions","organizations_url":"https://api.github.com/users/dmbates/orgs","repos_url":"https://api.github.com/users/dmbates/repos","events_url":"https://api.github.com/users/dmbates/events{/privacy}","received_events_url":"https://api.github.com/users/dmbates/received_events","type":"User","site_admin":false},"created_at":"2015-06-12T18:03:34Z","updated_at":"2015-06-12T18:03:34Z","body":"Great idea.  When I wrote that section of csparse.jl I was imitating the C code and wasn't aware of Functors. Obviously this is a good use of Functors."}}