Hacker News new | ask | show | jobs
by DNF2 1827 days ago
Cannot reply to deeply nested posts, so I put the answer up here:

> This is not a necessity, but an implementation choice.

The performance of Julia relies on algorithmic specialization, and since you do not know what input types your code will receive, you cannot take advantage of clever specializations. I understand that you reject the concept of allowing user types that can be used by generic functions, but then you throw all the performance out the window. I want to do fast linear algebra, but your library says "no special static arrays!", "no special handling of diagonal matrices", and in general no exploitation of special structure in user types.

I want to calculate fast derivatives, but your library doesn't accept dual number types.

Your code will never be fast if it's only fast Float64, because it's when my special type elides all computation that the real speedups arrive.

> "Specialization" is an unnecessary step when everything is explicit from the beginning.

But you cannot know what it should be explicit about. I give your `sum` function a special Range vector, or a BitVector, or a OneHot vector. What should it do? It has to fall back to the same thing it does with all arrays: add-add-add-add-add. What is the norm of my UnitVector type? Your library has to ploddingly square, sum and sqrt. In the meantime, multiple dispatch just replaces the call with the number 1.0.

> If "matlab with fast loops" is "nothing" to you, sure.

As a daily user of Matlab for 25 years, several tens of thousands of hours of grudging use, I assure you it would be less than nothing. Matlab is a tragic, horrible mess of a language, and it's not even that slow! I rue every hour I've spent on it. If Julia were slow, and Matlab faster, I would still prefer Julia.

Also, Matlab has OOP and sigular dispatch.

> But there's nothing wrong that each user has different favorite parts of the language!

Well, as I am trying to say, multiple dispatch isn't a part of the language. It is the language. Everything revolves around that concept.