-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BigInt and BigFloat performance is poor #4176
Comments
Simply making BigFloats mutable doesn't really solve the problem, since although our current slowness is crazy, mutable numbers are also crazy. Natural mathematical code uses an immutable style, and all our Number-related APIs and functions are designed for this. For example, a library function might contain
where the second line changes |
Did anyone find a workaround for this issue? I have also been hit by bad performance with BigFloat matrix multiplication etc. |
No. We could expose some mutating operations on BigFloats but it could really easily lead to very confusing behavior if not used with great care. |
Note that our |
Pull request for Pooling BigInts opened #10084 |
Hello, I came across this issue from google "BigInt Julia performance". Thank you for your dedicated work on Julia. |
Someone with permissions should label this with bignums |
See also #11202 |
BigFloat operations generate unnecessary garbage (mainly to immutability, it seems), ctor, dtor copying and alloc/free operations in general (they may be cheap for a Float32, but not for a BigFloat --and it gets even worse with increased precision).
One (natural) result is, matrix multiplication has awful performance.
Sample test case (from a real-world program)
I think BigFloat should be mutable, or at least there should a mutable version of it. Immutable
BigFloat
s are just crazy and are guaranteed to perform very bad in Julia programs, unless some other clever way is found.For comparison, the C++ equivalent of the above program (which uses only one temporary for matrix multiplication, but nevertheless makes a temporary copy of
A
duringA = A*B
, and makes no other allocations during the loop) runs at ~20x speed and uses 1/300x memory at the moment.The text was updated successfully, but these errors were encountered: