News for hackers. Stuff that matters.
Re:Introducing the B3 JIT compiler by munificent on Monday February 15, 2016 @12:04PM (#11104406)
> Compilers are sexy, but they're very much a solved problem.

Not for all of the other widely-used languages that still have incredibly simple interpreters. Think how much energy could have been saved if Ruby, Python, and PHP were all as fast as your average JS engine.

Re:Introducing the B3 JIT compiler by seanwilson on Monday February 15, 2016 @02:44PM (#11105434)
> Think how much energy could have been saved if Ruby, Python, and PHP

I would think we'd see even better improvements if developers would move towards statically typed languages as well.

Re:Introducing the B3 JIT compiler by VeejayRampay on Monday February 15, 2016 @12:18PM (#11104511)
Exactly. Ruby would probably have massive adoption with JS-like speed.
Re:Introducing the B3 JIT compiler by chrisseaton on Monday February 15, 2016 @01:45PM (#11105104)
My implementation of Ruby, JRuby+Truffle, is as fast as V8

http://stefan-marr.de/downloads/crystal.html

Re:Introducing the B3 JIT compiler by pizlonator on Monday February 15, 2016 @02:44PM (#11105436)
Note that usually being "as fast as" a production JSVM means also proving that you can start up as fast as JSVMs do. Have you done this?
Re:Introducing the B3 JIT compiler by ehsanu1 on Monday February 15, 2016 @03:22PM (#11105658)
Search around for "Substrate VM". I see it referenced in some slide decks, and it's designed to make JVM startup much faster.

Here's an old slidedeck that talks about it: http://www.oracle.com/technetwork/java/jvmls2013wimmer-20140...

Re:Introducing the B3 JIT compiler by ksec on Monday February 15, 2016 @05:04PM (#11106401)
Wow thx for the reminder, I have forgotten about it already. I remember the promise of Truffle + Graal + Substrate VM.

My god can't believe it was 3 years ago i read about it on HN.

Re:Introducing the B3 JIT compiler by pizlonator on Monday February 15, 2016 @03:25PM (#11105681)
I know about it. I'm not concerned with future hypotheticals, but current actual measurements.

That's the currency I deal in.

Re:Introducing the B3 JIT compiler by ehsanu1 on Monday February 15, 2016 @08:56PM (#11107426)
There seem to be measurements in the slides I reference, so it wasn't exactly "future work". But of course it sucks that this work is not yet publicly available (AFAIK), probably due to not being 100% production ready yet. But I'm sure it's getting there.
Re:Introducing the B3 JIT compiler by ajross on Monday February 15, 2016 @12:29PM (#11104595)
Ruby has massive adoption, as do Python and Perl and PHP. Environments with objectively better performance like the JVM and .NET have not, in fact, done all that well comparatively in this environment (which is to say they've done fine too and achieved "massive" adoption, just not that much better than their slower competitors).

In fact, looking at the market as it stands right now I'd say that performance concerns are almost entirely uncorrelated with programming environment adoption.

Re:Introducing the B3 JIT compiler by yxhuvud on Monday February 15, 2016 @01:14PM (#11104912)
Considering the massive speed improvements we have been seeing in Javascript, but also languages like Ruby, I'd say compilers is a solved problem for staticly compiled languages, but perhaps not as much for interpreted highly expressive languages.
Re:Introducing the B3 JIT compiler by abecedarius on Monday February 15, 2016 @01:48PM (#11105119)
Sort of. Lisp had a good combo of expressiveness and speed in the 80s, but it reached that point on the efficiency frontier by different techniques, like heavier use of macros. The newer techniques like trace compilation can make life even better, but the language design decisions in Ruby/Python/etc. that made that sort of thing necessary if you want speed, they didn't really pay for themselves from the perspective of smug Lisp weenies like me who were happy enough with our language and just wanted pragmatics like libraries.
Re:Introducing the B3 JIT compiler by sklogic on Monday February 15, 2016 @02:47PM (#11105454)
Did you just call Javascript a "highly expressive" language? Really?!?
Re:Introducing the B3 JIT compiler by pizlonator on Monday February 15, 2016 @03:34PM (#11105735)
LOL! It is expressive though. It's got really powerful first-class functions. It's got classes. It's got prototypes. It's got generators. It's got other things that I don't even remember (but will probably have to learn, to implement them, make them fast, and then fix the bugs).

I actually think that the reason why JS is so odd is that it is so expressive. That tends to happen with kitchen sink languages like C++.

Relevant: "There are only two kinds of programming languages: those people always bitch about and those nobody uses."

Re:Introducing the B3 JIT compiler by raattgift on Tuesday February 16, 2016 @06:08AM (#11109109)
Cool. "We took a dynamic language and made it fast(er again)".

And you're gonna apply that to the darkest corners of ES6? Whee, language theory nerd paradise!

I can't wait for the compilers targeting that using all sorts of really odd idioms that in effect work like fuzz testing.

https://www.destroyallsoftware.com/talks/the-birth-and-death...

Re:Introducing the B3 JIT compiler by sklogic on Monday February 15, 2016 @05:07PM (#11106417)
More expressive than a less imaginative subset of C. More expressive than assembler. Much less expressive than any decent high-level language.

Javascript is low level, primitive and clumsy. There is absolutely no excuse for it being so crappy.

If you still think it is "expressive", you never seen an expressive language.

Re:Introducing the B3 JIT compiler by pcwalton on Monday February 15, 2016 @06:48PM (#11106945)
> If you still think it is "expressive", you never seen an expressive language.

Are you aware who Filip Pizlo is?

Re:Introducing the B3 JIT compiler by sklogic on Monday February 15, 2016 @07:36PM (#11107129)
Of course - a low level guy. It is quite likely that he is either not exposed at all to any expressive languages or reject them out of ideological reasons (JikesRVM is quite a strong symptom of the latter case).
Re:Introducing the B3 JIT compiler by pcwalton on Monday February 15, 2016 @07:53PM (#11107212)
I have no idea what the Jikes RVM has to do with "ideology". The point is that you're trying to tell someone who has a significant academic and industrial PL pedigree that they don't know what an expressive language is.

You seem to have an intense dislike of JavaScript. I'll the first one to admit that JavaScript has a lot of problems. But not being expressive enough is not one of them. JS is, if anything, too dynamic and expressive.

Re:Introducing the B3 JIT compiler by sklogic on Monday February 15, 2016 @10:41PM (#11107758)
Yes, if he thinks that JS is expressive he does not know what is expressive. And his track record clearly lacks anything related to any expressive language. I can only explain it with an ideology, because ignorance is not an option here.

And, no, JS is not expressive. It got strict limits on an available level of abstraction (unless you go into eval, of course).

Re:Introducing the B3 JIT compiler by pizlonator on Monday February 15, 2016 @12:35PM (#11104652)
ajross is right. People choose the languages they like regardless of performance.

JS perf is important to users though. Faster execution means fewer watts spent rendering and interacting with your favorite web page.

(Fun fact: B3's backend contains a machine description language that gets compiled to C++ code by a ruby script, opcode_generator.rb. We use Ruby a lot.)

Re:Introducing the B3 JIT compiler by cosinusoidally on Monday February 15, 2016 @03:56PM (#11105892)
Why didn't you use JavaScript for that purpose (in a similar vein to how LuaJIT uses Lua for dynasm)?
Re:Introducing the B3 JIT compiler by pizlonator on Monday February 15, 2016 @04:19PM (#11106082)
I'm not a big fan of self-hosting. I like that you can build JavaScriptCore without using JavaScriptCore.
Re:Introducing the B3 JIT compiler by cosinusoidally on Monday February 15, 2016 @08:39PM (#11107376)
I wasn't really referring to self hosting. I was wondering whether it made sense to write tools like JavaScriptCore's offlineasm in JavaScript rather than Ruby (as LuaJIT does by using Lua for its dynasm tool). The LuaJIT build process actually builds a cut down copy for Lua for the purposes of running dynasm, which is then used to build parts of LuaJIT.
Re:Introducing the B3 JIT compiler by pizlonator on Tuesday February 16, 2016 @12:22AM (#11108045)
We spend time optimizing JavaScriptCore's build time. It's a hard problem and it's important when managing such a large project. People inevitably have to do clean builds and that sucks when you have >400k lines of C++ code.

So, naturally, we want to avoid building JSC twice. ;-)

Re:Introducing the B3 JIT compiler by iso-8859-1 on Monday February 15, 2016 @07:42PM (#11107163)
Suppose that you are developing not to push this platform, but to simple do better on this platform. What does self-hosting gain you in that case?
Re:Introducing the B3 JIT compiler by geodel on Monday February 15, 2016 @12:27PM (#11104577)
Lately quite a few apps are saving energy by moving from Ruby/Python/PHP to Go.
Re:Introducing the B3 JIT compiler by pcwalton on Monday February 15, 2016 @01:25PM (#11104985)
And Go proves munificent's point: it doesn't have many compiler optimizations either. (This may change with the WIP SSA backend, but the point remains that Go gained huge popularity in spite of having a non-optimizing compiler.)
Re:Introducing the B3 JIT compiler by pjmlp on Monday February 15, 2016 @02:23PM (#11105295)
Yeah, more interesting is having them rediscovering Turbo Pascal compile speeds.

EDIT: I wonder why the positive effect to re-discovering that not all compilers need to be like C and C++ compile speeds and that it was once upon a time mainstream, is worthy of downvotes.

Re:Introducing the B3 JIT compiler by nickpsecurity on Monday February 15, 2016 @03:15PM (#11105615)
Can't critique this one: Go was an attempt to re-create the Oberon experience in modern setting with some additions from other languages. Rather than accidental re-discovery, getting Oberon (not Pascal) speed out of the compiler was an explicit design goal. One of few examples of modern IT really learning from the past.

Unfortunately, they didn't learn about the stuff between Oberon and 2007 that would've been nice to have in a modern, app language. ;)

Re:Introducing the B3 JIT compiler by pjmlp on Monday February 15, 2016 @03:38PM (#11105767)
It is not a critic, apparently it was understood as such.

The remark is tailored to those that think compiled languages can only be slow as C and C++ compilers, since they never used anything else, and then jump of joy when they use Go.

Yet if it wasn't for the VM detour of the last 20 years, that experience would probably be a current one, instead of being re-discovered.

Re:Introducing the B3 JIT compiler by nickpsecurity on Monday February 15, 2016 @04:04PM (#11105955)
"The remark is tailored to those..."

Ahh. Ok.

"Yet if it wasn't for the VM detour of the last 20 years"

You mean the C++ and VM detours? ;)

Re:Introducing the B3 JIT compiler by pjmlp on Monday February 15, 2016 @04:37PM (#11106214)
I mean having the JVM not adopt the tooling model of Eiffel, OCaml and others where you get to choose bytecode/JIT for developing and AOT compilation for release builds.
Re:Introducing the B3 JIT compiler by nickpsecurity on Monday February 15, 2016 @05:11PM (#11106438)
Oh i hear you. That makes sense. I wanted all of them to do incremental compilation or interactive development for build then AOT for deploy. We're on same page there.
Re:Introducing the B3 JIT compiler by srean on Tuesday February 16, 2016 @09:28AM (#11109980)
For the curious (I am sure pjmlp is well aware of this) D and Go compile speeds are pretty neck and neck. DMD was faster, then Go caught on, not sure which one is faster now, depends on the nod. If I may add, D is a lot less impoverished than Go, although its coroutines story is not that strong.
Re:Introducing the B3 JIT compiler by geodel on Monday February 15, 2016 @03:19PM (#11105640)
Are you claiming Go runs at the speed of Ruby/Python/PHP etc? Because from what I read, migration to Go from above mentioned language led to lot of hardware / memory saving. I'd think Java can certainly be considered having highly optimized compiler / runtime. But it has almost same performance as Go and much higher memory usage compared to Go.

http://benchmarksgame.alioth.debian.org/u64q/go.html

Re:Introducing the B3 JIT compiler by pcwalton on Monday February 15, 2016 @03:25PM (#11105683)
> Are you claiming Go runs at the speed of Ruby/Python/PHP etc?

No. I'm claiming it doesn't perform anywhere near the level of optimization of GCC and LLVM.

> I'd think Java can certainly be considered having highly optimized compiler / runtime. But it has almost same performance as Go and much higher memory usage compared to Go.

I disagree with what seems to be your implication that compiler optimizations don't matter (and almost everyone else who works on compilers would also disagree), but I don't really want to turn this thread into a critique of the benchmarks game, so let's just leave it at that.

Re:Introducing the B3 JIT compiler by igouy on Monday February 15, 2016 @07:39PM (#11107146)
> … and much higher memory usage compared to Go.

Please don't jump to the conclusion that huge differences in the default memory allocation of tiny 100 line programs means there will be similar huge differences between ordinary large programs.

Notice that even for those tiny 100 line programs, the difference can be more like 2x when memory actually needs to allocated for the task.

Re:Introducing the B3 JIT compiler by derefr on Monday February 15, 2016 @04:37PM (#11106222)
"Compiler optimization" in this thread is referring to speeding up compilation time†, not runtime of generated code. Go produces fast code, but the go compiler does not generate that code particularly quickly.

† Which can be seen as a runtime cost for interpreter+JIT languages, but that's a different issue. We're talking time-to-steady-state when the interpreter is fed a file (which is something Javascript engine devs worry about a lot), not benchmark-speed-at-steady-state.

Re:Introducing the B3 JIT compiler by pcwalton on Monday February 15, 2016 @05:03PM (#11106392)
No, it's the opposite. The Go compiler generates medium quality code but compiles fast.
Re:Introducing the B3 JIT compiler by sklogic on Monday February 15, 2016 @02:46PM (#11105441)
If Ruby, Python and PHP would suddenly disappear, even more effort and energy would have been saved.