{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/11522","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/11522/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/11522/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/11522/events","html_url":"https://github.com/JuliaLang/julia/issues/11522","id":83562403,"number":11522,"title":"Faster Rational-like type","user":{"login":"timholy","id":1525481,"avatar_url":"https://avatars.githubusercontent.com/u/1525481?v=3","gravatar_id":"","url":"https://api.github.com/users/timholy","html_url":"https://github.com/timholy","followers_url":"https://api.github.com/users/timholy/followers","following_url":"https://api.github.com/users/timholy/following{/other_user}","gists_url":"https://api.github.com/users/timholy/gists{/gist_id}","starred_url":"https://api.github.com/users/timholy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timholy/subscriptions","organizations_url":"https://api.github.com/users/timholy/orgs","repos_url":"https://api.github.com/users/timholy/repos","events_url":"https://api.github.com/users/timholy/events{/privacy}","received_events_url":"https://api.github.com/users/timholy/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaLang/julia/labels/maths","name":"maths","color":"009800"},{"url":"https://api.github.com/repos/JuliaLang/julia/labels/performance","name":"performance","color":"d7e102"},{"url":"https://api.github.com/repos/JuliaLang/julia/labels/rationals","name":"rationals","color":"fbca04"},{"url":"https://api.github.com/repos/JuliaLang/julia/labels/up%20for%20grabs","name":"up for grabs","color":"0b02e1"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":22,"created_at":"2015-06-01T15:30:36Z","updated_at":"2015-06-07T18:04:46Z","closed_at":null,"body":"Over in https://github.com/tlycken/Interpolations.jl/pull/36#issuecomment-106895591 and https://github.com/tlycken/Interpolations.jl/pull/37 it was discovered that doing computations with `Rational` is slow, because basically every usage calls `gcd` and `div`. The advantage of calling `gcd` and `div` is that it makes the type much less vulnerable to overflow, and that is a Good Thing. But as we discovered, certain computations may not need that kind of care, so there may be room for a faster variant. Switching to a [stripped down variant](https://github.com/tlycken/Interpolations.jl/blob/0255ad884b4684da42f5f01db372e642844c1bae/src/ratio.jl) provided an approximate 50-fold speed boost. \r\n\r\nI suspect certain computations may demand an implementation that is as minimalistic as that `Ratio` type. There may also be an area of intermediate interest, where a `Rational`-like object is represented in terms of pre-factorized numbers, perhaps numerator and denominator each being a `Dict{Int,Int}` representing the base and power of the factors."},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/109784546","html_url":"https://github.com/JuliaLang/julia/issues/11522#issuecomment-109784546","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/11522","id":109784546,"user":{"login":"simonbyrne","id":1692009,"avatar_url":"https://avatars.githubusercontent.com/u/1692009?v=3","gravatar_id":"","url":"https://api.github.com/users/simonbyrne","html_url":"https://github.com/simonbyrne","followers_url":"https://api.github.com/users/simonbyrne/followers","following_url":"https://api.github.com/users/simonbyrne/following{/other_user}","gists_url":"https://api.github.com/users/simonbyrne/gists{/gist_id}","starred_url":"https://api.github.com/users/simonbyrne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonbyrne/subscriptions","organizations_url":"https://api.github.com/users/simonbyrne/orgs","repos_url":"https://api.github.com/users/simonbyrne/repos","events_url":"https://api.github.com/users/simonbyrne/events{/privacy}","received_events_url":"https://api.github.com/users/simonbyrne/received_events","type":"User","site_admin":false},"created_at":"2015-06-07T18:04:46Z","updated_at":"2015-06-07T18:04:46Z","body":"Ah, sorry I missed that. Yes, you're right (though if you run it a second time it does work correctly)."}}