Napa.js: a multi-threaded JavaScript runtime
Перейти к файлу
Yulong Wang f0786f7386 Enable pre-build for napa.js (#41)
* Onboard node-pre-gyp

* Add missing dependencies

* Remove node-pre-gyp from bundledDependencies

* run prepare scripts under NPM<4.x

* fix string template

* Update version of package dependencies

* re-organize installation logs

* Add build logs for fallback logic

* Rename the test module name from 'simple-napa-addon' to 'simple-addon'

* Fix auto-resolve error

* Fix error in install.js
2017-08-17 17:10:20 -07:00
benchmark Release candidate for 0.1.0 (#23) 2017-08-03 16:14:30 -07:00
docs Polish zone.execute: transported function will inherit __dirname from caller. (#40) 2017-08-16 18:39:36 -07:00
examples Formalize module development depending on 'napajs' (#38) 2017-08-16 18:44:52 -07:00
inc Release candidate for 0.1.0 (#23) 2017-08-03 16:14:30 -07:00
lib Polish zone.execute: transported function will inherit __dirname from caller. (#40) 2017-08-16 18:39:36 -07:00
node Merged PR 327797: Support Mac 2017-07-19 17:00:55 -07:00
scripts Enable pre-build for napa.js (#41) 2017-08-17 17:10:20 -07:00
src Polish zone.execute: transported function will inherit __dirname from caller. (#40) 2017-08-16 18:39:36 -07:00
test Enable pre-build for napa.js (#41) 2017-08-17 17:10:20 -07:00
third-party Merged PR 327505: Merge dev/dapeng/license to master 2017-07-19 00:29:19 +00:00
unittest Release candidate for 0.1.0 (#23) 2017-08-03 16:14:30 -07:00
.gitignore Release candidate for 0.1.0 (#23) 2017-08-03 16:14:30 -07:00
.npmignore Update CI build matrix for travis and appveyor (#35) 2017-08-10 15:37:44 -07:00
.travis.yml Enable pre-build for napa.js (#41) 2017-08-17 17:10:20 -07:00
CMakeLists.txt Enable pre-build for napa.js (#41) 2017-08-17 17:10:20 -07:00
LICENSE.txt Merged PR 327505: Merge dev/dapeng/license to master 2017-07-19 00:29:19 +00:00
README.md Update CI build matrix for travis and appveyor (#35) 2017-08-10 15:37:44 -07:00
appveyor.yml Enable pre-build for napa.js (#41) 2017-08-17 17:10:20 -07:00
package.json Enable pre-build for napa.js (#41) 2017-08-17 17:10:20 -07:00

README.md

Build Status for Linux/MacOS Build Status for Windows npm version Downloads

Napa.js

Napa.js is a multi-threaded JavaScript runtime built on V8, which was originally designed to develop highly iterative services with non-compromised performance in Bing. As it evolves, we find it useful to complement Node.js in CPU-bound tasks, with the capability of executing JavaScript in multiple V8 isolates and communicating between them. Napa.js is exposed as a Node.js module, while it can also be embedded in a host process without Node.js dependency.

Supported OS and Compilers

Napa.js requires C++ compiler that supports C++14, currently we have tested following OS/compiler combinations:

  • Windows: 7+ with VC 2015+ (MSVC14.0+)
  • Linux: Ubuntu 14.04 LTS, 16.04 TLS, with gcc 5.4+
  • OSX: 10.11 (Yosemite), Apple LLVM 7.0.2 (clang-700.1.18)

Installation

Prerequisites

Install Napa.js

npm install napajs

* You can also build Napa.js from source.

Quick Start

var napa = require('napajs');
var zone1 = napa.zone.create('zone1', { workers: 4} );

// Broadcast code to all 4 workers in 'zone1'.
zone1.broadcast('console.log("hello world");');

// Execute an anonymous function in any worker thread in 'zone1'.
zone1.execute(
    (text) => {
        return text;
    }, 
    ['hello napa'])
    .then((result) => {
        console.log(result.value);
    });

More examples:

Features

  • Multi-threaded JavaScript runtime
  • Node.js compatible module architecture with NPM support
  • API for object transportation, object sharing and synchronization across JavaScript threads
  • API for pluggable logging, metric and memory allocator
  • Distributed as a Node.js module, as well as supporting embed scenarios

Documentation

Contribute

You can contribute to Napa.js in following ways:

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Contacts