4 ms·
I disagree that C++ is high level in the same way. The core of the language’s memory management relying at some level on bare pointers adds complexity that can
by oivey 3y ago
I disagree that C++ is high level in the same way. The core of the language’s memory management relying at some level on bare pointers adds complexity that can never be removed. The syntax itself is not simple and rarely has the magic of 1 line of code expanding into an incredibly complex yet simply understandable computation. That functionality cannot even be retrofitted on because its metaprogramming system sucks.
PyPy will still never be as fast as C++ because the semantics of Python itself make it hard to compile into efficient code. Funny enough, Haskell has that similar problem that it’s difficult to compile well. That’s the actual magic of Julia: its semantics are designed so it can be compiled to fast code while still being ergonomic like Python. Mojo may end up being good, but in the examples I’ve seen the real “fast” part of the language doesn’t look all that much like Python anyway.
- pjmlp 3y agoAs mentioned, some people insist in using C++ as if it was C. Smalltalk, Common Lisp, JavaScript, SELF, Dylan JIT implementations, for highly dynamic languages, beg to differ. Some of those, anything in the process space can change at any time, either by using language features, or stopping into the debugger, changing the world as much as we like, hit continue or retry as if it was still the original code. The Python dynamism as a problem is an excuse from a language culture that sees writing C extensions as being Python code, thus not willing to spend the resources to make it happen. Thankfully even Ruby is leaving Python behind, joining the list of highly dynamic languages with a JIT in the baggage.
- oivey 3y agoNo, it’s not just that people write C++ like it’s C. Another example: there is no simple syntax for broadcasting a function over a collection. Anonymous functions have syntax that is all parentheses and brackets. They’re this way because adding them to the language itself would be breaking. You can’t easily improve the syntax of these things yourself for your subset of code because the meta programming systems C++ has just aren’t great compared to Lisp and Lispy languages like Julia. Further, even if you do add a bunch of cool stuff yourself like a GC or some other syntax magic, it rarely composes well with other libraries. Core to this is that inheritance never really panned out as hoped, and templates are cumbersome. C++ has come a long way, but all of that is due to the overall design of the language itself, not just how it is used. Can you write something as fast as BLAS in JavaScript? As far as I know, the answer is no. Python’s dynamism makes it so that a compiler often times can’t do anything to infer what some function calls will do. No investment will completely fix it without breaking changes to the language itself.
- pjmlp 3y agoI suggest learning about C++ ranges and CUDA algorithms. Parenthesis and brackets have nothing to do with how high level a language happens to be. BLAS in JavaScript would certainly be faster than Python, this is what is being discussed here. Again the dynamism excuse. You can change ANYTHING in Smalltalk, SELF, Common Lisp, and their JITs make up for it. Might not be C++ fast by today standards, as those languages don't see much investment nowadays, they certainly beat Python no matter what.
- oivey 3y ago> I suggest learning about C++ ranges and CUDA algorithms. I’m familiar. > Parenthesis and brackets have nothing to do with how high level a language happens to be. I would argue readability and expressiveness do, though. When someone is talking about high level languages in the context of Python, they don’t mean in terms of instructions, registers, and interrupts. > BLAS in JavaScript would certainly be faster than Python, this is what is being discussed here. No, it explicitly is not. You originally replied to my comment that it was impressive how Julia in this case was competitive with Fortran and much faster than Python. You agree that no JavaScript JIT is going to make it as fast as C/C++/Fortran, right? > Again the dynamism excuse. Julia is a dynamic language, so I’m not sure what excuse you think I’m making. The reality is that the languages you cited generally are not competitive with C/C++/Fortran. The reality is that none of the languages you cited are even being considered for those applications. The reality is that languages that have had massive investment in a JIT like JavaScript are still relatively slow. Julia seems to be different than the other dynamic languages you cited in this regard. Why do you think the relatively small investments in Julia have been able to achieve this while others, often with more resources, have failed? I think it probably has something to do with the language design.
- pjmlp 3y agoI am not arguing against Julia, I am arguing against Python, but you aren't getting it at all. I am not going to bother with Julia vs C++ evangelism. By the way, there are 1980's papers about Common Lisp versus Fortran floating point performance, that you can certainly easily find out.