News for hackers. Stuff that matters.
Re:Graal and Truffle could accelerate programming language d... by dangerlibrary on Tuesday July 19, 2016 @12:52PM (#12122877)
There are a lot of weasel words for the other languages, but the comment about ruby is extremely interesting:

"For example, the TruffleJS engine which implements JavaScript is competitive with V8 in benchmarks. The RubyTruffle engine is faster than all other Ruby implementations by far. The TruffleC engine is roughly competitive with GCC."

Re:Graal and Truffle could accelerate programming language d... by matthewrudy on Tuesday July 19, 2016 @01:10PM (#12123037)
Chris Seaton gave this talk recently about JRuby+Truffle and some specifics about how it optimises so well compared to other Ruby implementations.

https://youtu.be/b1NTaVQPt1E

Previous discussion

https://news.ycombinator.com/item?id=12062454

Re:Graal and Truffle could accelerate programming language d... by vidarh on Tuesday July 19, 2016 @01:32PM (#12123248)
Chris is also reasonably active here.

I've had the pleasure of discussing some of his jRuby work with him in the past (I occasionally plod along with own Ruby compiler in Ruby - it's nowhere near complete) and they've done a lot of impressive work to demonstrate how compiling Ruby into fast code is largely about assuming people will behave sanely (e.g. people won't usually give Fixnum#+ side-effects, or make it return weird stuff), but add fallbacks for when they do.

This is the big challenge with Ruby: The subset of Ruby that people actually tend to work in is largely very predictable and possible to compile efficiently, but there's a lot of stuff around the fringes that people expect to work on the very rare occasions that we use it.

Re:Graal and Truffle could accelerate programming language d... by azakai on Tuesday July 19, 2016 @01:15PM (#12123085)
I believe those benchmarks are for throughput, though. JS VM startup times (including v8) are highly optimized, while Graal+Truffle run on the JVM which is more optimized for sustained speed.

JS VMs also tend to have multiple tiers for that reason - interpreter, baseline, and full JIT, etc. - while AFAIK the Graal+Truffle/JVM approach has just 2 (which is optimal for Java, but not for startup times of JavaScript and other dynamic languages).

Re:Graal and Truffle could accelerate programming language d... by the8472 on Tuesday July 19, 2016 @01:27PM (#12123213)
Startup times are mostly important for scripting or running things in the browser. If you start applications once on the server or desktop and keep them running then steady-state performance is more important.

There also are projects underway to bring AOT compilation / caching of compiled code to the JVM. Right now they're only available to commercial customers due to their experimental nature and the needed support but if I remember the talk correctly they're supposed to be added to openjdk eventually

Re:Graal and Truffle could accelerate programming language d... by azakai on Tuesday July 19, 2016 @01:43PM (#12123336)
True about AOT coming to the JVM, however, dynamic languages can't be AOT'd well in general, so that won't help Graal+Truffle languages much.

Instead, dynamic languages tend to do tiering, which in principle is something Graal+Truffle could do, but it might be a lot of work.

Re:Graal and Truffle could accelerate programming language d... by hencq on Tuesday July 19, 2016 @05:54PM (#12125233)
Well at least it would help you avoid warm-up for the interpreter/compiler itself, so it might help a bit.
Re:Graal and Truffle could accelerate programming language d... by geodel on Tuesday July 19, 2016 @12:57PM (#12122920)
> The TruffleC engine is roughly competitive with GCC

It is not surprising in sense Java is competitive to C/C++ as per many Java developers.

Re:Graal and Truffle could accelerate programming language d... by pjmlp on Tuesday July 19, 2016 @01:11PM (#12123049)
I work with .NET, Java and C++ stacks.

In many use cases, C++ might win the benchmark game, but the end user will not notice any difference in human time.

The biggest issue is of course than one needs to learn how to optimize code, use the right algorithms and data structures in first place.

Re:Graal and Truffle could accelerate programming language d... by spriggan3 on Tuesday July 19, 2016 @02:09PM (#12123572)
> In many use cases, C++ might win the benchmark game, but the end user will not notice any difference in human time.

If the program runs on the user's machine, I'm pretty certain the users WILL notice the difference, memory wise.

Re:Graal and Truffle could accelerate programming language d... by merb on Tuesday July 19, 2016 @04:29PM (#12124637)
That's not true. Do you know Cyberduck? It actually takes less memory than most other FTP/SFTP etc programs. and probably feels a dozen times more smooth than most clients.
Re:Graal and Truffle could accelerate programming language d... by pjmlp on Tuesday July 19, 2016 @04:40PM (#12124723)
As I said "use the right algorithms and data structures in first place".
Re:Graal and Truffle could accelerate programming language d... by geodel on Tuesday July 19, 2016 @01:17PM (#12123097)
I agree mostly. Any Java application which does not need GUI other than web is just fine in most use cases.
Re:Graal and Truffle could accelerate programming language d... by the_duke on Tuesday July 19, 2016 @01:39PM (#12123297)
UIs though...

I haven't worked with a single Java based GUI application that did feel smooth, fast and efficient.

I wonder why that is.

Re:Graal and Truffle could accelerate programming language d... by pjmlp on Tuesday July 19, 2016 @01:47PM (#12123372)
Because most developers don't care and code everything on the UI thread.

Additionally Swing has bad defaults, so it requires effort to make the required set of calls to make them look better.

Back in the Sun glory days, there were Sun blogs like Filthy Rich Clients, which lead eventually to a book http://filthyrichclients.org/.

It was a consequence of Sun not getting what it means developing GUIs for the consumer systems, think that their Solaris UIs (SunView, OpenWindows, CDE) weren't that great in that area.

So most Java developers stick with the defaults and as such the majority of Java based applications send the wrong message.

Re:Graal and Truffle could accelerate programming language d... by vvanders on Tuesday July 19, 2016 @02:15PM (#12123624)
Android does a bunch of things to keep you off the UI thread(IO throws an exception, handlers, Async Tasks, etc).

You still have to GC at some point and when that happens chances are you're going to drop frames. Unless you're very aware of the garbage you're creating you'll take more than ~5ms which is usually enough to push you over 16ms with the other work that goes on during a frame.

Re:Graal and Truffle could accelerate programming language d... by pjmlp on Tuesday July 19, 2016 @02:57PM (#12123947)
Measure Java performance by how Android works is not a good measure.

Dalvik is well known on Java world for having a JIT and GC implementations that worse than what most commercial embedded JVM are capable of.

Things have improved with ART, but even there there are quite a few performance improvements that Google could eventually do.

Soft real time Java GCs for embedded devices are being used in ground station controls of missiles and a couple of US Navy weapon systems. They surely don't want GC glitches in battle situations.

The Android team seems to only bother with "good enough" in what concerns Android performance.

As a side note, just check how many Android releases are they going through and yet real-audio support isn't quite there. Even Windows Phone has better support for it, and they do have WinRT and .NET on them.

Re:Graal and Truffle could accelerate programming language d... by bitmapbrother on Tuesday July 19, 2016 @06:40PM (#12125499)
>As a side note, just check how many Android releases are they going through and yet real-audio support isn't quite there

Actually, there is. As of Android 6.0 Google's CCD includes a section for Professional Audio devices

If a device implementation meets all of the following requirements, it is STRONGLY RECOMMENDED to report support for feature android.hardware.audio.pro via the android.content.pm.PackageManager class.

The device implementation MUST report support for feature android.hardware.audio.low_latency.

The continuous round-trip audio latency, as defined in section 5.6 Audio Latency, MUST be 20 milliseconds or less and SHOULD be 10 milliseconds or less over at least one supported path.

If the device includes a 4 conductor 3.5mm audio jack, the continuous round-trip audio latency MUST be 20 milliseconds or less over the audio jack path, and SHOULD be 10 milliseconds or less over at the audio jack path.

The device implementation MUST include a USB port(s) supporting USB host mode and USB peripheral mode.

The USB host mode MUST implement the USB audio class. If the device includes an HDMI port, the device implementation MUST support output in stereo and eight channels at 20-bit or 24-bit depth and 192 kHz without bit-depth loss or resampling.

The device implementation MUST report support for feature android.software.midi.

If the device includes a 4 conductor 3.5mm audio jack, the device implementation is STRONGLY RECOMMENDED to comply with section Mobile device (jack) specifications of the Wired Audio Headset Specification (v1.1).

Re:Graal and Truffle could accelerate programming language d... by pjmlp on Wednesday July 20, 2016 @02:29AM (#12127243)
I saw the Google IO 2016 presentation where Google acknowledged Android 6.0 didn't actually fully delivered but Android 7.0 is finally there.

They even had Samsung on stage to talk about their Android extensions for real-time audio.

So with Android 6.0 barely over 10%, still with issues fixed in Android 7.0, it is as I said "real-audio support isn't quite there".

Re:Graal and Truffle could accelerate programming language d... by bitmapbrother on Tuesday July 19, 2016 @04:42PM (#12124737)
>Even Windows Phone has better support for it, and they do have WinRT and .NET on them.

No they don't. Point me to one windows phone audio app that has low latency audio.

Re:Graal and Truffle could accelerate programming language d... by pjmlp on Tuesday July 19, 2016 @04:57PM (#12124835)
Re:Graal and Truffle could accelerate programming language d... by bitmapbrother on Tuesday July 19, 2016 @06:34PM (#12125456)
You linked to an app that measures audio db levels. There are no low latency audio / music apps because windows phone isn't very good at it.
Re:Graal and Truffle could accelerate programming language d... by pjmlp on Tuesday July 19, 2016 @06:56PM (#12125582)
Or maybe because no one capable of writing such applications wants to target 1% market share?

Sometimes being good at something isn't enough.

Re:Graal and Truffle could accelerate programming language d... by bitmapbrother on Tuesday July 19, 2016 @07:08PM (#12125643)
I wonder if BB users also use that excuse.
Re:Graal and Truffle could accelerate programming language d... by pjmlp on Wednesday July 20, 2016 @12:41AM (#12126940)
I didn't use it as an excuse.

I am no real time audio expert, but as someone that does work on Windows, I saw the information I have posted back when it went live.

So it is possible, that in spite of the support being there, no one cares about it due to the sad state of the Windows Phone market and not because they suck.

Or I suck at understanding how real time audio is supposed to work and the support isn't really there in spite of what Microsoft says.

Re:Graal and Truffle could accelerate programming language d... by merb on Tuesday July 19, 2016 @04:29PM (#12124645)
do you use or know cyberduck?