Napa.js: a multi-threaded JavaScript runtime
Перейти к файлу
Yulong Wang 8f6b8b2efb [ci skip] Update Napa.js to version 0.2.0 (#182) 2018-01-05 16:10:20 -08:00
benchmark Release candidate for 0.1.0 (#23) 2017-08-03 16:14:30 -07:00
docs Add an example that uses napa.sync.Lock (#179) 2018-01-05 15:19:54 -08:00
examples Add an example that uses napa.sync.Lock (#179) 2018-01-05 15:19:54 -08:00
inc Remove trailing semi-colon in macro definitions (#127) 2018-01-05 13:10:57 -08:00
lib fix bug when transporting 'null' (#181) 2018-01-05 15:15:27 -08:00
node Fix RPATH for shared library (#81) 2017-10-19 15:32:57 -07:00
scripts napa embeded support for Linux (#110) 2017-11-08 11:14:18 -08:00
src Remove trailing semi-colon in macro definitions (#127) 2018-01-05 13:10:57 -08:00
test fix bug when transporting 'null' (#181) 2018-01-05 15:15:27 -08:00
third-party Merged PR 327505: Merge dev/dapeng/license to master 2017-07-19 00:29:19 +00:00
unittest Add cache for ModuleResolver (#128) 2017-11-13 11:41:04 -08:00
.gitignore convert transport builtin types test to TypeScript (#168) 2017-12-23 08:49:09 -08:00
.npmignore Add file npm-debug.log to ignore list (#159) 2017-12-14 14:49:47 -08:00
.travis.yml Fix Node's version to 9.2.1 on CI build (Linux) (#163) 2017-12-18 15:37:38 -08: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 Add an example that uses napa.sync.Lock (#179) 2018-01-05 15:19:54 -08:00
appveyor.yml Revert CI node version for LTS/current to latest (#136) 2017-11-22 15:28:18 -08:00
build.bat Added a script for building napa in embed mode (#47) 2017-08-28 17:21:13 -07:00
build.js Added a script for building napa in embed mode (#47) 2017-08-28 17:21:13 -07:00
package.json [ci skip] Update Napa.js to version 0.2.0 (#182) 2018-01-05 16:10:20 -08: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.

Installation

Install the latest stable version:

npm install napajs

Other options can be found in Build Napa.js.

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) => 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:

  • Report issues and help us verify fixes as they are checked in.
  • Review the source code changes.
  • Contribute to core module compatibility with Node.
  • Contribute bug fixes.

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.

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT License.