If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Chrome Now Supports Concurrent JavaScript Compilation

Phoronix: Chrome Now Supports Concurrent JavaScript Compilation

With Google's never-ending mission of improving the performance of their Chrome/Chromium web-browser and their V8 JavaScript engine, the latest beta of the open-source web-browser now supports concurrent compilation of JavaScript in the background...

Do they plan to ship the Dart VM with Chrome or they plan to use Dart to generate JS serverside, just like Microsoft does with Typescript as a way to improve development and maintanability of web page code?

They plan to ship Dart VM in Chrome. However, right now Chromes garbage collector is
too simple and too limited to support more than one language in a good way, which means
they have some work to do before they can ship Dart VM. Also the Dart VM is still in a
pretty early stage so they might want to do more filing before shipping it.

The biggest advantage of these multithreaded architecture should be responsiveness.
Responsiveness and performance are two very different things.
But of course background compiling of JavaScript to get optimized executable code should increase performance too.

Do they plan to ship the Dart VM with Chrome or they plan to use Dart to generate JS serverside, just like Microsoft does with Typescript as a way to improve development and maintanability of web page code?

Chrome will almost surely be the first browser to ship Dart VM, but IMHO that won't be too soon. They need a staging area for Dart, so Chrome would be the best candidate. However to do this they need to undergo a transition phase, while Dart is still not mainstream. When Dart becomes mainstream, it might become standardized, and then Firefox will ship it too. However the transition phase wont be easy. They need to think of a way that can let developers write in Dart, but embed both the Dart source and dart2js-compiled js source while running only one of them, depending on availability of Dart. A js script should do the job, but not everyone wants to embed 2 similarly functional sources in one page, and then an extra script that manages their execution.

They need to think of a way that can let developers write in Dart, but embed both the Dart source and dart2js-compiled js source while running only one of them, depending on availability of Dart. A js script should do the job, but not everyone wants to embed 2 similarly functional sources in one page, and then an extra script that manages their execution.

It is already there. Just look at this beauty

Code:

// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
(function() {
// Bootstrap support for Dart scripts on the page as this script.
if (navigator.userAgent.indexOf('(Dart)') === -1) {
// TODO:
// - Support in-browser compilation.
// - Handle inline Dart scripts.
// Fall back to compiled JS. Run through all the scripts and
// replace them if they have a type that indicate that they source
// in Dart code (type="application/dart").
var scripts = document.getElementsByTagName("script");
var length = scripts.length;
for (var i = 0; i < length; ++i) {
if (scripts[i].type == "application/dart") {
// Remap foo.dart to foo.dart.js.
if (scripts[i].src && scripts[i].src != '') {
var script = document.createElement('script');
script.src = scripts[i].src.replace(/\.dart(?=\?|$)/, '.dart.js');
var parent = scripts[i].parentNode;
// TODO(vsm): Find a solution for issue 8455 that works with more
// than one script.
document.currentScript = script;
parent.replaceChild(script, scripts[i]);
}
}
}
}
})();

If browser behave well they shouldn't even download scipts tagged with "application/dart"
if they doesn't support it. So the only extra cost is that short javascript (that could be
minified to be extreamly short). And if you inline it it won't even require an extra request.