News for hackers. Stuff that matters.
Re:20M digits of pi in 1 minute using Julia by tiffanyh on Friday March 03, 2023 @08:40PM (#35017270)
Is 1-minute fast?
Re:20M digits of pi in 1 minute using Julia by juliusgeo on Friday March 03, 2023 @08:44PM (#35017292)
In the article I compare my implementation to the MPFR pi implementation which is in pure C. So the fact I’m able to get close to that performance in Julia is impressive(I think).
Re:20M digits of pi in 1 minute using Julia by Joel_Mckay on Friday March 03, 2023 @10:07PM (#35017755)
All variables held the same, Julia often beats C, NumPy, and most other languages.

Julia also supports transparent Cluster API and CUDA integration. i.e. the hot-mess you hope to never have to maintain professionally.

In my humble opinion, the utility of this high-level language makes it fundamentally different. Thus, it is slowly becoming more mainstream as the ecosystem stabilizes.

Remember to have fun =)

Re:20M digits of pi in 1 minute using Julia by jiggawatts on Saturday March 04, 2023 @03:26AM (#35019236)
I just ran the same thing in Mathematica and I got 20 million digits in just over 7 seconds.

You can have "very high level functional programming" and 8x the speed of Julia in a mathematics-oriented language!

Re:20M digits of pi in 1 minute using Julia by Joel_Mckay on Saturday March 04, 2023 @04:20AM (#35019482)
Mathematica does several optimizations before execution, and as such can exploit a priori knowledge of many problems.

The danger of course is when Wolfram takes those assumptions into a room of mathematicians. It is controversial for all the wrong reasons. =)

Re:20M digits of pi in 1 minute using Julia by Max_Limelihood on Saturday March 04, 2023 @02:16PM (#35023590)
Julia already is a very high-level mathematics-oriented programming language, though.

The reason Mathematica is so much faster here is it’s using a different algorithm. When you compare using the same algorithm, Julia is 10-100x faster than Mathematica. https://julialang.org/benchmarks/

Re:20M digits of pi in 1 minute using Julia by bboygravity on Saturday March 04, 2023 @07:51AM (#35020424)
But last I checked there's Julia for Python? So you could get the best of both world (nice syntax of Python and the speed of Julia).
Re:20M digits of pi in 1 minute using Julia by Joel_Mckay on Saturday March 04, 2023 @11:39AM (#35022144)
Yes, Julia has wrappers for many other languages, so there are options if you really need some specific chunk of C/C++, Fortran, Python, Octave or R etc.

Yet a polyglot project is bad design, and tends to become an abomination in time. This is one reason many Go programmers rewrote libraries rather than saturate their code with cgo/C and SWIG/C++ wrappers. Similarly, people are writing scalable versions of libraries in Julia to improve transparent parallel performance for problems too big for a single machine to feasibly handle.

Things are still undergoing change, but of course the commercial nvidia binary blobs will haunt everyone for awhile. =)

Re:20M digits of pi in 1 minute using Julia by Max_Limelihood on Saturday March 04, 2023 @02:24PM (#35023666)
I feel like you’re misunderstanding how Julia syntax works. Julia syntax is Python syntax, for the most part. They’re not identical, but the differences are very small, and typically favor Julia—for example, compare:

x*(y.^2)

To the Python equivalent:

np.matmul(x, map(lambda x : x^2, y))

Note also that the first will be much faster because it can fuse the matrix multiplication with the exponentiation. That’s because Julia is a single language, and the whole thing is compiled at the same time. Python can’t fix the above code because NumPy is written in C, not Python.

Julia is just Python but fast.

Re:20M digits of pi in 1 minute using Julia by ftxbro on Friday March 03, 2023 @10:22PM (#35017844)
When I googled digits of pi I found http://www.numberworld.org/y-cruncher/ where they get 25M digits in about one second (rather than one minute) depending on what kind of computer you use.
Re:20M digits of pi in 1 minute using Julia by juliusgeo on Friday March 03, 2023 @10:28PM (#35017862)
y-cruncher is the state of the art but it is also not written in a language like julia, and doubtlessly occupies many more lines of code
Re:20M digits of pi in 1 minute using Julia by Olreich on Friday March 03, 2023 @10:36PM (#35017905)
Y-cruncher is closed source, there’s no way to know the number of lines of code it uses compared to Julia.
Re:20M digits of pi in 1 minute using Julia by juliusgeo on Friday March 03, 2023 @10:44PM (#35017947)
That is true, but isn’t it then more useful to provide an open source method of computation at these ranges?
Re:20M digits of pi in 1 minute using Julia by ewams on Friday March 03, 2023 @10:43PM (#35017944)
I've done 2.5 billion digits in 88 seconds with ycruncher. That's about 28.4 million digits a second?

http://ewams.net/?date=2020/04/17&view=sockets_vs_cores_for_...

Though that is with a broadwell CPU and about 3 years ago. Might see if I can get my hands on a 6348 ice lake CPU and see how she burns.