Live data from Hacker News

Microsoft Edge's JavaScript engine to go open-source

blogs.windows.com

21–30 of 283 posts

Re: Microsoft Edge's JavaScript engine to go open-source

#21
post #10

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.

I don't think there is anything preventing JS running shared memory threads. Apart from all the existing code and libraries which aren't thread safe, but that's the case in many languages.

Re: Microsoft Edge's JavaScript engine to go open-source

#22
post #11

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?

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++?

Servo is use in production by any browser? or any Project like Chakra? or is just an experiment till now?

Re: Microsoft Edge's JavaScript engine to go open-source

#23

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 ?

Building a javascript engine is super simple. But to build one that has performance on par with the current crop will take you - as a single person - a lifetime and by then the state of the art will have moved on.

Re: Microsoft Edge's JavaScript engine to go open-source

#24
post #10

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.

There is nothing in the language itself that allows multi-threading. Going forward, they are adding support in the language for the async keyword, similar to F#. Any way to achieve parallelism would have to be from APIs, e.g., like WebWorkers in the browser.

Re: Microsoft Edge's JavaScript engine to go open-source

#25
post #11

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?

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++?

Servo currently uses SpiderMonkey as its JavaScript engine (SpiderMonkey is the Firefox JS engine). Sure, a JavaScript engine written at Rust would be useful at some point, but right now that's not on their roadmap.

Re: Microsoft Edge's JavaScript engine to go open-source

#26

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 ?

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.

Re: Microsoft Edge's JavaScript engine to go open-source

#27
post #10

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.

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.

Re: Microsoft Edge's JavaScript engine to go open-source

#28
post #3

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.

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 c…

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.

Re: Microsoft Edge's JavaScript engine to go open-source

#29
post #11

Earlier quoted context omitted.

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++?

Servo currently uses SpiderMonkey as its JavaScript engine (SpiderMonkey is the Firefox JS engine). Sure, a JavaScript engine written at Rust would be useful at some point, but right now that's not on their roadmap.

From what I heard, it is on a roadmap, just not on Servo's. Apparently, it'll someday be a sister project to Servo.

Re: Microsoft Edge's JavaScript engine to go open-source

#30

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 ?

It's not as impossible as it sounds.

There are many JS engines which are extremely small compared to the big guys used in browsers. Most of them tend to grab a subset of the language and implement that.

For example, the creators of nginx created their own specialized engine called nginScript that runs JS for their stuff https://www.nginx.com/resources/wiki/nginScript/

There is even a javascript interpreter written in javascript which can be a good starting point to learn a bit how it works https://github.com/jterrace/js.js/

Post reply on HN