JavaScript Source Code Protection Performance Vastly Improved

1,077 views
Skip to first unread message

Roger Wang

unread,
Mar 24, 2017, 2:26:02 AM3/24/17
to nwjs-g...@googlegroups.com
https://nwjs.io/blog/js-src-protect-perf/

Four years ago we released JavaScript Source Code protection feature in v0.4.2. It gives programmers capability to compile their source code to binary machine code so that their intellectual property could be protected in a better way. This follows one of the founding idea of the project - let JavaScript programmers do everything that C/C++ programmers can do. From the feedback, I can say that many users are using it happily although it suffers from a performance issue, that compiled binary code runs slower than JS source code (~30% according to v8bench).

Today, I'm excited to announce that the performance issue has been fixed: compiled binary code now run as fast as JS source code without performance overhead. This brings 3x-4x improvement according to our test:

before-the-fix after-the-fix

The fix has been released in v0.22.0-beta1 under a flag. And it will be turned on by default in v0.23.0. To use it, pass --future when you compile the source code and start NW:

$ nwjc --future source.js compiled.bin
$ nw --js-flags="--future" .

See more here to learn how to use the source code protection feature.

It has been exactly a year after we released the 0.13 milestone. After that we executed well on keeping close updates with Chromium upstream. NW major version bumps within 1 day or even on the same day after every Chromium browser stable upgrade. We delivered many new features and optimizations in the web engine while keeps up the quality. I'm happy to write this blog post 1 year later and see what has been done. Moving forward, we expect to keep pace and please stay tuned for more exciting news.

Matjaž Trontelj

unread,
Mar 24, 2017, 5:51:23 AM3/24/17
to nw.js, ro...@nwjs.io
Roger & the NWJS team, thanks for all the work you do on NWJS! This is a great news. Source protection is an important feature for us at Pinegrow. For the past 3+ years node-webkit and NWJS have taken a lot of technical complexity out of delivering our product for all major platforms and growing our business on the way. 

Mislav Boras

unread,
Mar 24, 2017, 8:27:32 AM3/24/17
to Matjaž Trontelj, nw.js, ro...@nwjs.io
Hello Roger,

This is really a huge step! Thank you for that. Source code protection without performance loss bringt nw.js to a new level in which all of the code can be protected. For now i had to decide what code can/should be protected. 
I also had to be really carefull about the dependecies. It is one of the major features where nw.js outperforms electron! 

Keep up the good work :) I am really exited about the new feature!

Best, 
Mislav

--
You received this message because you are subscribed to the Google Groups "nw.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nwjs-general...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Henrry Ticona

unread,
Mar 26, 2017, 10:59:36 AM3/26/17
to nw.js, ro...@nwjs.io
Thank you! Mr. Roger Wang and the whole team for the great work, this new update is really great!, cheers from Bolivia :)

c.pres...@gmail.com

unread,
Apr 5, 2017, 3:54:42 AM4/5/17
to nw.js, ro...@nwjs.io
Best news I've heard in a while. 

You guys are doing an amazing job. Thanks Roger!

c.pres...@gmail.com

unread,
Apr 5, 2017, 8:32:19 AM4/5/17
to nw.js, ro...@nwjs.io, c.pres...@gmail.com
are there any known bugs still in the beta with using --future?


Roger Wang

unread,
Apr 5, 2017, 10:56:23 PM4/5/17
to c.pres...@gmail.com, nw.js, ro...@nwjs.io

On Wed, Apr 5, 2017 at 8:32 PM <c.pres...@gmail.com> wrote:
are there any known bugs still in the beta with using --future?


bhupendrak...@gmail.com

unread,
Jul 12, 2018, 9:13:00 AM7/12/18
to nw.js
Reply all
Reply to author
Forward
0 new messages