News for hackers. Stuff that matters.
Re:Perl 11 by jerf on Tuesday October 23, 2018 @07:40PM (#18288460)
That was a fun theory 15-20 years ago. We've now got piles of evidence it doesn't work that way. JITs can accelerate slow languages, at a stiff RAM penalty, but they still remain noticeably slower than faster languages.

Claims to the contrary at this point will require concrete demonstration. Starting from the union of Perl 5 and Perl 6 is just about the worst starting point for that goal I can imagine. (Not necessarily because "Perl sucks", but because any such solution to that problem is probably going to require writing the language with that goal from day 1, not taking existing languages as a given. Or, like LuaJIT, cutting things that don't fit. And between Perl 5 and Perl 6, there are sooooo many "things"....)

Re:Perl 11 by hyperpape on Tuesday October 23, 2018 @08:07PM (#18288580)
I'm with you about the overall point that Perl5/6 are not going to get C/C++ speed.

However, on the specific point, why do you think the JIT forces high memory usage? In the case of Java, my perception is that it's the pervasive use of boxed types everywhere and a standard library that's past its sell-by-date that drives bloated memory usage.

Maybe my sense of things is a little skewed by my work: I work on server processes that use gigs of memory. There, the resources for the JVM/JIT itself usually use vastly less memory than the java objects contained in the heap (probably 10x, and this is for a monolith with thousands of classes).

Re:Perl 11 by cryptos on Wednesday October 24, 2018 @07:45AM (#18291533)
The JVM uses the memory to optimize the garbage collection, so it is a tradeoff between memory usage and speed (favoring the latter).
Re:Perl 11 by richardwhiuk on Tuesday October 23, 2018 @10:04PM (#18289111)
It's the pervasive requirement of a dynamically typed language, not the JIT per say.
Re:Perl 11 by snapdangle on Wednesday October 24, 2018 @01:15AM (#18289892)
And yet Perl 6 has been droppping their performance floor by enormous factors, with a lot of room for improvement still.

Everyone always shrugged at me when I explained that Perl 6 was designed to be able to be fast, with the ability to outstrip Perl and even other languages.

And now that it's happening? They are still shrugging, but its the uncomfortable shrug of someone trying to shake off an inconvenient truth.

Re:Perl 11 by jerf on Wednesday October 24, 2018 @09:41AM (#18292297)
"And yet Perl 6 has been droppping their performance floor by enormous factors, with a lot of room for improvement still."

Considering the literally-unusable performance that Perl 6 has had within fairly recent memory, getting a lot faster hasn't been that impressive.

Plus, goals aren't results. I'll believe Perl 6 is natively fast when somebody actually shows it outcompeting, say, Rust, on some non-trivial task, written in the native idiom. No fair just sitting there in a loop and adding integers, which is easy-mode for a JIT. Show me a real program, that I didn't have to write in a magical subset of Perl 6 to get the performance (a problem Javascript has, "fast JIT'ed Javascript" is a mysterious and ever-changing subset, where your performance can be tanked at any moment by the smallest of changes), and don't tell me about how it's a 100x faster than last year, show me how it's faster than Rust now. Or, heck, just show me beating Go. I'll believe when I see it. And I will believe it when I see it. I have no problem with that. But I've seen the whole "as good as or better than C" claims a lot over the years, and the people making those claims are batting nearly 0.000. (Rust is pretty much the only language with a chance.)

You seem to believe in the existence of a bunch of people who have somehow wrapped their identity around hating Perl 6. That's not it; what you're seeing is that the Perl 6 community burned through their goodwill literally years ago, and now people are just exasperated when the topic comes up. If it helps you to identify as some sort of persecuted minority, hey, go nuts [1], it's a very popular option nowadays, but the Perl 6 community is years past the point where mocking the potential customers into trying it is going to do any good. You're going to need hard evidence... really, really hard evidence, probably rather a lot of it, more than you'll probably think is fair but such is the hole the Perl 6 community has dug itself into over the years... to convince people, not mockery.

[1]: Actually I think it's a terrible and very unhealthy idea; you'll find none of the collected ancient wisdom of humanity will tell you that constantly nursing a persecution complex is the way to wisdom or happiness. But such is the zeitgeist of the era.

Re:Perl 11 by lizmat on Wednesday October 24, 2018 @10:07AM (#18292517)
> You seem to believe in the existence of a bunch of people who have somehow wrapped their identity around hating Perl 6.

You only have to go to PerlMonks to find them. It's not that hard.

> the Perl 6 community burned through their goodwill literally years ago

That may be so, but most Perl 6 people from that era, either have left or have reverted to lurking mode. The current Perl 6 community mostly consist of people who have become active during the last implementation attempt, based on 6model and MoarVM. And who are focused on results.

> You're going to need hard evidence

Working on it :-). https://twitter.com/zoffix/status/1045623538345017344 shows an object creation benchmark compared to Perl 5 (Perl 6 having become faster than Perl 5), and a "real world" benchmark that's been running for 4+ years: https://tux.nl/Talks/CSV6/speed.log

Yes, it's still not as fast as one would like it to be. Still, as said before, Rakudo on MoarVM is designed to be able to support runtime optimizations. If you like to find out more about how these optimizations are done, check out Jonathan Worthington's blog: https://6guts.wordpress.com

Re:Perl 11 by petre on Wednesday October 24, 2018 @03:21PM (#18295527)
> I'll believe Perl 6 is natively fast when somebody actually shows it outcompeting, say, Rust, on some non-trivial task, written in the native idiom.

If it beats Java then it's fine. I do not expect a VM language to be faster than machine code. Rust is also overhyped. I did some of my own benchmarks and Go and D turned out faster than Rust, or at least their maps/associative arrays are faster that Rust's HashMap. Also, I won't use stuff that is not in the stdlib in the benchmarks.

Re:Perl 11 by steveklabnik on Wednesday October 24, 2018 @04:48PM (#18296233)
> I did some of my own benchmarks and Go and D turned out faster than Rust, or at least their maps/associative arrays are faster that Rust's HashMap. Also, I won't use stuff that is not in the stdlib in the benchmarks.

Rust's HashMaps are intentionally slow by default. You could use a different hash function with them if you want different properties. That means writing your own if you don't want a known-good implementation, of course, but this is expected and not really representative of Rust generally, which uses associative arrays pretty infrequently.

Re:Perl 11 by microtherion on Wednesday October 24, 2018 @09:47AM (#18292359)
Correct me if I'm wrong, but isn't Perl 6 still considerably slower than Perl 5?
Re:Perl 11 by cygx on Wednesday October 24, 2018 @01:51PM (#18294716)
As a rule of thumb, that's probably still accurate. But there are specific areas where Rakudo on MoarVM already outperforms the Perl5 interpreter (eg an object creation benchmark was mentioned elsewhere).

I suspect the scale will eventually tilt in Perl6's favour, but is has been slow going...

Re:Perl 11 by village-idiot on Wednesday October 24, 2018 @08:41AM (#18291865)
A lot of them are probably shrugging because they have 0 interest in Perl, and you telling them more about Perl is not going to change their mind.

I personally could not care less about Perl 6’s speed, I will never use it anyways.

Re:Perl 11 by FridgeSeal on Tuesday October 23, 2018 @10:01PM (#18289093)
> JITs can accelerate slow languages, at a stiff RAM penalty, but they still remain noticeably slower than faster languages.

The Julia language would like a word.

It compiles to native machine code via LLVM, which is the same backend that a lot of statically typed languages use, and bar it's very first run, it can run blindingly fast: I've been using it instead of Python at work for Data Science things and it's been great.

Re:Perl 11 by kibwen on Tuesday October 23, 2018 @10:36PM (#18289265)
As I understand it, Julia's current implementation is not a JIT in any comparable sense to the JVM. Julia's JIT does not use any runtime information to optimize code; it's literally just statically compiling each function on-demand as they are encountered. You would get equivalent runtime performance by having a separate up-front compiler step, as C has. And actually, this sort of implies that Julia doesn't do inlining, the mother of all optimizations, which would mean that you'd be sacrificing quite a lot of runtime performance compared to an up-front compiled implementation.

https://discourse.julialang.org/t/notes-on-the-julia-compile...

Re:Perl 11 by byt143 on Tuesday October 23, 2018 @11:40PM (#18289534)
Actually Julia is aggressively inlined because it's easy to statically determine function calls at compile time...that's why the libraries are able to use such nice abstractions.

It's already ahead of time compilable, just needs some work to emit smaller binaries and cover some corner cases

Re:Perl 11 by kibwen on Wednesday October 24, 2018 @09:31AM (#18292201)
Good to know, thanks.
Re:Perl 11 by jashmatthews on Wednesday October 24, 2018 @01:16AM (#18289898)
> As I understand it, Julia's current implementation is not a JIT in any comparable sense

Going straight to machine code via baseline compilation is a common JIT technique. Until a couple of years ago, V8 compiled everything.

Re:Perl 11 by kibwen on Wednesday October 24, 2018 @09:28AM (#18292183)
Baseline compilation is fine, that wasn't what I was referring to. I the context of this thread, the long-awaited promise of JIT is the ability to profile running code to dynamically determine the hot portions and re-optimize on the fly, and do this continually for the entire runtime of the program. This is what people mean by "things that are impossible for a static compiler to do" (though PGO is a decent approximation), and the basis of all discussions that begin with "actually, Java can be faster than C". This is not to say that Julia does not satisfy the definition of a JIT, only that using Julia as an example of this principle appears to be mistaken. Julia is not fast because it dynamically re-optimizes, it's fast because it uses a mature C compiler backend.
Re:Perl 11 by ihnorton on Wednesday October 24, 2018 @08:27AM (#18291800)
Julia does not have a tracing JIT right now, but does use runtime information in order to JIT specializations based on (often inferred) method argument types.
Re:Perl 11 by jerf on Wednesday October 24, 2018 @09:30AM (#18292195)
For your point to be a disagreement, you'd first have to agree that Julia is a "slow language", that is sped up by a JIT. Would you agree with that? Or is it an example of a sort of language that I referenced, one that was designed to perform well from the beginning that may use some technology that looks like a JIT (though as others pointed out, not necessarily really the same)?
Re:Perl 11 by koolba on Tuesday October 23, 2018 @08:29PM (#18288689)
I didn’t mean to say I think it’s possible in this particular case for arbitrary code (particular for something as wild as Perl!). I was merely explaining (what I think) is the logic behind the approach.

The only circumstance I can see where a true JIT will beat out native code is when there are many possible paths of execution such that all may not be possible to evaluate at compile time. In that case it’s not even really interpreted vs compiled so much as static vs adaptive.