
Microsoft Edge's JavaScript engine to go open-source - clarle
https://blogs.windows.com/msedgedev/2015/12/05/open-source-chakra-core/
======
roddux
Wait, Edge does better on ES6 coverage than both Chrome and Firefox? Microsoft
have seriously stepped up their game, especially seeing as it's now neck and
neck for performance with Chrome: [http://venturebeat.com/2015/09/10/browser-
benchmark-battle-s...](http://venturebeat.com/2015/09/10/browser-benchmark-
battle-september-2015-chrome-vs-firefox-vs-edge/view-all/)

~~~
jandem
The next Firefox Nightly build should get 84% on that page, much closer to
Edge than Firefox 44 (74%).

I work on SpiderMonkey and I'm super excited about this news. All JS engines
have added more-or-less similar performance optimizations but often
implemented differently and I'm really interested to see what the Chakra team
did. I'd be happy to write a blog post on it next month, if people are
interested.

~~~
Scarbutt
One would think Firefox would lead here, since the browser is Mozilla's
primary product, imagine how much hype and PR Firefox would get if only they
were far ahead on ES6.

~~~
judofyr
The browser is the primary product to the Chrome team. Does it make any
difference?

~~~
coldtea
It's obviously the primary product to ANY browser development team.

The question is if its also the primary product of the COMPANY the development
team belongs.

~~~
saurik
What is actually relevant here is whether the percentage that Google considers
Chrome to be valuable to their company times the resources of the company is
competitive against the resources Mozilla has (times the percentage that
Mozilla considers the browser their focus, as they clearly spend a lot of
money on side projects people sometimes seem to enjoy, such as Persona).
Mozilla is small enough (at least in comparison to Google) that I think
comparing their entire company to one division at Google is probably the
correct strategy.

~~~
st3fan
And not all of us at Mozilla actually work on Firefox. I don't know the number
but we work on a lot of different things.

~~~
coldtea
Maybe keep more focus on Firefox then?

As it has been losing ground for a decade or so, and without it there is no
Mozilla. I see some crazy initiatives obviously doomed to fail (like the
mobile OS), which are worrying.

Coming up with a Servo based browser that's both more secure due to Rust AND
faster due to parallel processing, and a better native-look-and-feel story (at
least on the Mac) would be good to catch up with the others. And better
developer tools, as Chrome has eaten that influential segment (web devs) up.

~~~
JupiterMoon
I think that firefox has improved their dev tools significantly no? I thought
that Chrome and Firefox were neck and neck on this at the moment? With some
features better in one and some features better in the other.

------
vonklaus
I find myself hoping Microsoft makes a comeback and they are really doing a
lot to win developers which I think is the right move. Obviously, they are a
huge platform and developers inherently will be using it but they have taken a
lot of great steps like open sourcing this engine as well as other projects.

The Code editor they released is built on Atom Electron and seems more
performant than Atom in the few experiences I have had switching between them.

If they can continue to gain trust in the community and improve their UI they
could become great again. You can tell they have thought about how to do this.
A few years ago now I remember the guys from the IE team did an AMA about the
new explorer IIRC it was 10. They talked about cross browser compatibility and
wanted developer feedback.

I am not sure if they are actually an "underdog" but I find myself feeling
like that, and hoping they can get it together.

~~~
zer0defex
Ditto - and I agree, underdog doesn't quite feel like the right word. It's
more like yesterday's champion coming out of retirement to deliver some good
old-fashioned ego checks on today's cocky up-and-comers. Either way, it's fun
to watch.

------
Sir_Cmpwn
Wow, I'll admit that I haven't been looking at Edge simply because of the IE
stigma, but this blog post impressed me. 90% ES6 support? More so than Babel?
Awesome. And it's getting open sourced! I hope to see it ported to the Unixes.
Perhaps Servo+Chakra could be a thing?

~~~
nly
Servo is a rendering engine written in Rust, why would it choose Chakra, which
is written in C++, over WebKit, which is written in C++?

~~~
Manishearth
You're comparing apples and oranges here.

Rendering engines (all in C++ except Servo):

\- Servo

\- Blink (Chrome/Opera)

\- Trident/Spartan (IE/Edge)

\- Webkit (Safari)

JS engines:

\- Spidermonkey (used by Servo and Firefox)

\- Chakra (used by Trident/Edge)

\- V8 (used by Blink, also by Node)

Servo already uses a JS engine in C++ because a Rust JS engine is a huge
undertaking in itself (see [1])

It does make sense to try out Chakra or V8 for Servo. It's probably a lot of
work, though. And there may not be a net gain out of that (We have access to
in-house spidermonkey know-how, none of that for the others).

[1]:
[https://news.ycombinator.com/item?id=10682274](https://news.ycombinator.com/item?id=10682274)

~~~
apaprocki
I have a vested interest in creating a SM -> Chakra adapter to swap out
SpiderMonkey and be able to compare it to see how it does because Chakra is
also an interpreter and not JIT-only like V8. Such an adapter would also make
playing with Servo -> Chakra possible. I haven't play with Servo, but is there
a list of all the JSAPI calls that it needs to function or can you easily dump
that list?

~~~
Natanael_L
[https://news.ycombinator.com/item?id=10682291](https://news.ycombinator.com/item?id=10682291)
this?

~~~
Manishearth
Yep. See also: [https://github.com/servo/rust-
mozjs](https://github.com/servo/rust-mozjs)

------
adrianlmm
I'd like to see Node.js using Chkara by default, V8 developers have showed
that they don't care much about Node.js, they are more interested in Chrome,
and MS have showed more interest in Node.js than Google and I'm sure it will
be better for all, fingers crossed.

~~~
frik
I don't. A lot of code out in the wild already relies on v8, and won't work
with Chkara. Node 5 is up-to-date with v8. Though, I would like to see Mozilla
devsvwpuld revives the unofficial spidermonkey Node.js support
([https://news.ycombinator.com/item?id=2469786](https://news.ycombinator.com/item?id=2469786)
, [https://github.com/zpao/spidernode](https://github.com/zpao/spidernode) ).

~~~
aravindet
This is definitely a problem today, but NAN
([https://github.com/nodejs/nan](https://github.com/nodejs/nan)) which is now
the recommended way to build native modules, offers a way out. That project
provides a stable API to insulate module developers from changes between v8
versions.

Sometime down the line, a NAN-spidermonkey or NAN-chakra project might become
feasible.

~~~
lmeyerov
Sort of -- in practice, we found ourselves instead playing catchup to NAN
(many changes across Node 10, 12, 4, etc.). It insulates from _minor_ changes,
and increasingly, part of that has been Node waiting longer and longer between
v8 changes.

------
oblio
I have a somewhat off topic question: is there anything in the design of
Javascript that mandates single-threadedness? Could any Javascript engine
implement threads?

I'm asking because I'm wondering if Node.js's evented approach is the only way
to do things.

~~~
devit
If you allow threads to share memory arbitrarily you need to add locking to
all internal VM structures, which is going to be a significant slowdown.

Also it's not (any longer) considered good practice to have languages that
allow mutable memory sharing since that makes software unreliable, so it's not
really a good idea.

Without arbitrary memory sharing, multi-threading is already supported with
web workers.

~~~
netheril96
Web Worker is very weird in that you have to have a separate file.

~~~
padolsey
Agreed! FWIW this is why I made Operative. It gives you a way of writing
"inline" JS that utilizes web workers (caveat: not actually inline; no
scope/context access of course). It provides good support across browsers and
fallbacks for envs where web workers don't exist (and ~all the in-between
cases):
[https://github.com/padolsey/operative](https://github.com/padolsey/operative)

~~~
chadscira
Looks nice! I took a stab at this a while back
[https://gist.github.com/icodeforlove/deb0f19a9e7bd528bd48](https://gist.github.com/icodeforlove/deb0f19a9e7bd528bd48)

------
jfoster
No mention of license. Is it safe to assume it'll be Apache or MIT?

~~~
abchatra
I work for Chakra team and it is going to under MIT license.

~~~
proyb
Good idea. And please add support for WebMIDI.

~~~
abchatra
WebMIDI is not owned by Chakra. Please voice your opinion here

[https://wpdev.uservoice.com/forums/257854-microsoft-edge-
dev...](https://wpdev.uservoice.com/forums/257854-microsoft-edge-
developer/suggestions/6508429-web-midi-api)

------
datashovel
Microsoft is slowly but surely winning me as a fan. Keep doing things that
matter, show that you're committed to the open source community, and continue
to help push the web forward and I think nothing but good things will come
from this.

------
miralabs
I wonder if in the future node will enable swappable js engine edit: ok just
found this
[https://news.ycombinator.com/item?id=9534138](https://news.ycombinator.com/item?id=9534138)

~~~
Klathmon
I've hoped for this since it's inception.

It gives the benefits of having multiple competing implementations but unlike
the browser platform we (the developers) get to choose which one we use.

~~~
ndesaulniers
Native addons and even Node core are too tightly coupled with v8. NAN will
need an overhaul.

------
sdegutis
Wow. They're really serious about changing their philosophy aren't they. Using
Github for their stuff, making and open sourcing Visual Studio Code, other
stuff I can't remember, and now this.

~~~
outside1234
I was literally blown away by Visual Studio Code. It is an amazing editor. I
haven't opened sublime since.

~~~
corford
I really wanted to like VSCode but couldn't get over the "working files"
paradigm and consequent lack of tabs :(

Have gone back to Sublime 3 for now but if the VSCode devs ever decided to
support tabs I'd switch.

------
1971genocide
As a mere mortal - How hard would it be for a day programmer to built
something cool like an JavaScript engine ?

I sometimes have crazy thoughts about the world ending.

How hard would it be to built your own javascript engine from scratch ?

~~~
chrisseaton
These programs aren't magic. They use the same kind of constructs you use
every day to write your programs. They use some different algorithms, but you
can look those up in books and in existing engines. People who work on these
engines started where you started and there's no reason you can't pick up all
the skills over a few years.

~~~
AYBABTME
This is an excellent attitude.

------
gtirloni
Edge is certainly much faster than Chrome/Firefox for JS processing that I
wish I could use it on Linux. Looks like that might be happening. Really great
news.

I didn't know Node.js could use anything but v8. This is also very nice.

~~~
Klathmon
I'm not sure where the hangup is, but I've found that Edge is fast as hell for
initial page startup, but lags behind quite a lot when under heavy load.

I've seen the benchmarks but in my experience it just... lags...

For example, on the kangax ES6 compatibility table [1]. On chrome clicking a
column takes less than a second, on Edge (i'm on an up-to-date Windows 10
machine, no preview stuff) it loads faster than in chrome, but takes 3+
seconds to switch between columns.

Even some of the stuff i've written acts similarly, and i can't figure out
why.

[1][https://kangax.github.io/compat-
table/es6/](https://kangax.github.io/compat-table/es6/)

~~~
white-flame
I know between Chrome and Firefox for a particular project of mine (which is a
bit old now), Firefox ran raw JS faster, but Chrome could update its DOM
faster. FF would spend much more time when many updates needed to happen in a
large column of divs (10k+). Raw JS speed isn't everything.

~~~
Klathmon
I get that, the Kangax table was just an example I literally ran into moments
before.

But for a more "pure" js example, I have an app which does some image
processing in the browser using the canvas ImageData stuff and typed arrays.

For whatever reason my test case completes in about 3 seconds in chrome, 3 to
4 seconds in FF, 11 seconds in IE11, and 6 seconds in Edge.

I've profiled the hell out of it and i just can't figure out the reasoning for
it, but it's there. (and as a side note, having the dev tools open in Edge
obliterates javascript performance, my test case was taking 30+ seconds to run
when i had the dev tools open and it took me longer than i'd like to admit to
figure that one out)

I have a feeling the problem is that i'm optimizing for V8 because i know it
the best, and i'd much rather not do that if possible.

------
yuhong
I was wishing that MS Open Tech could make the other JS engines Windows x64
ABI compliant including SEH for a while now.

------
japhyr
We have a bunch of laptops at school running Windows 10 with Edge. Students
can't copy and paste into Google Docs while using Edge.

Was this a deliberate choice by Microsoft to steer people away from Google
products, or is it something more benign than that?

~~~
thekodols
If it fails when they paste via right-click menu, it's actually a known
issue/design decision on Drive's side. Try using shortcuts instead.

~~~
simoncion
> If it fails when they paste via right-click menu, it's actually a known
> issue/design decision on Drive's side.

I expect that if _this_ were the problem, OP wouldn't be mentioning it.

When you attempt to use the right-click menu to copy and paste, you get a
clearly-worded message box that tells you that you need to use the keyboard
shortcuts, and which keyboard shortcuts to use.

------
d0m
Out of curiosity, why rebuilding a whole new engine rather than
using/improving V8?

~~~
spicyj
They've already built it, I think before V8 existed or around the same
timeframe.

~~~
gsnedders
It was years later. V8 shipped in 2008, having been in development for (IIRC)
three years. Chakra got its first public preview release in 2010, and shipped
in 2011—I strongly suspect it started after V8 first shipped.

~~~
spicyj
Thanks for the correction.

------
mschuster91
What in blazes?! Okay MS, that's an impressive step.

I'm waiting for the first ports to Linux or, hell, a native port of IE...
given the trend, it's not unreasonable that MS will open source a load of
stuff.

~~~
nojvek
I just want node running on chakra on my linux box. Given MS has a lot of
money to make from Azure, I see this happening.

------
cdnsteve
Well I guess we can all start using ES6, no need to compile to ES5 anymore.

~~~
cpeterso
You will still need to compile to ES5 to support older browsers.

------
zobzu
There's no such thing as 'firefox alpha', its 'firefox nightly'

Kinda odd to see when they get the rest right and they're engineers. feels
like they dont know firefox o.O

------
rakstrooper
Here's hoping an android port Will be made by microsoft

------
caleblloyd
Fantastic news! Now all we need is for Edge to support Server Sent Events
(eventsource)

------
keklord
Yay I cant wait to test this out

------
shmerl
How about open sourcing the whole browser?

------
xxxxc308
Gg

------
idibidiart
Microsoft. Former Evil Empire. Current open source champion. What is not to
like? Leadership is everything.

