This commit is contained in:
Mason 2018-10-29 16:32:43 -04:00 коммит произвёл Allen Yongshuang Wang
Родитель aa3200e44d
Коммит 4c8fd412f7
6 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -11,7 +11,7 @@ We got this report on environment below:
| Name | Value |
|-------------------|---------------------------------------------------------------------------------------|
|**Processor** |Intel(R) Xeon(R) CPU L5640 @ 2.27GHz, 8 virtual procesors |
|**Processor** |Intel(R) Xeon(R) CPU L5640 @ 2.27GHz, 8 virtual processors |
|**System Type** |x64-based PC |
|**Physical Memory**|16.0 GB |
|**OS version** |Microsoft Windows Server 2012 R2 |
@ -90,7 +90,7 @@ Average overhead is around 0.06ms to 0.12ms for `zone.execute`.
## Transport overhead
The overhead of `transport.marshall` includes
1. overhead of needing replacer callback during JSON.stringify. (even empty callback will slowdown JSON.stringfiy significantly)
1. overhead of needing replacer callback during JSON.stringify. (even an empty callback will slow down JSON.stringify significantly)
2. traverse every value during JSON.stringify, to check value type and get `cid` to put into payload.
- a. If value doesn't need special care.
- b. If value is a transportable object that needs special care.

Просмотреть файл

@ -27,7 +27,7 @@ Napa.js follows [Node.js' convention](https://nodejs.org/api/modules.html) to su
4) API of creating C++ modules (addons) are similar. Napa.JS introduced macros that the same source code can be compiled to produce both Napa.js addon and Node.js addon.
But there are also differences:
1) C++ module that is designed/implemented for Napa.js can run on Node.JS (need different compile flags to produce '.napa' and '.node'). But not vice versal.
1) C++ module that is designed/implemented for Napa.js can run on Node.JS (need different compile flags to produce '.napa' and '.node'). But not vice versa.
2) Napa.js doesn't support all Node.js API. Node API are supported [incrementally](./node-api.md) on the motivation of adding Node.js built-ins and core modules that are needed for computation heavy tasks. You can access full capabilities of Node exposed via [Node zone](./zone.md#node-zone).
3) Napa.js doesn't provide `uv` functionalities, thus built-ins and core modules have its own implementation. To write async function in addon, methods `DoAsyncWork`/`PostAsyncWork` are introduced to work for both Napa.js and Node.js.
4) Napa.js supports embed mode. C++ modules need separate compilation between Node mode and embed mode.

Просмотреть файл

@ -23,7 +23,7 @@ Though very convenient, it's not recommended to use store to pass values within
Following APIs are exposed to create, get and operate upon stores.
### <a name="create"></a> create(id: string): Store
It creates a store by a string identifer that can be used to get the store later. When all references to the store from all JavaScript VMs are cleared, the store will be destroyed. Thus always keep a reference at global or module scope is usually a good practice using `Store`. Error will be thrown if the id already exists.
It creates a store by a string identifier that can be used to get the store later. When all references to the store from all JavaScript VMs are cleared, the store will be destroyed. Thus always keep a reference at global or module scope is usually a good practice using `Store`. Error will be thrown if the id already exists.
Example:
```js

Просмотреть файл

@ -11,7 +11,7 @@ var obj = addon.createPlusNumber();
## Wrapped class
*plus-number.h* declares ths class with one constructor and one method, *Add()*.
*plus-number.h* declares the class with one constructor and one method, *Add()*.
```h
namespace napa {

Просмотреть файл

@ -2,15 +2,15 @@
Napa runner is an example to embed Napa.JS into a C++ program. It simply runs JavaScript with all Napa capability without Node dependency from command line.
## How to build
1. Go to napajs root directory, run "node build.js embed" to build napa library for embeded mode.
1. Go to napajs root directory, run "node build.js embed" to build napa library for embedded mode.
**NOTE**: This step may take about 30 mins, because it will build V8 libray from Node. We are using node v6.10.3, a stable version can build as a library. It is specified in [embedded.js](https://github.com/Microsoft/napajs/blob/master/scripts/embedded.js) and [napa-runner CMakeLists.txt](https://github.com/Microsoft/napajs/blob/master/examples/tutorial/napa-runner/CMakeLists.txt). Please update both of them if you want to use a different version of Node/V8.
**NOTE**: This step may take about 30 mins, because it will build V8 library from Node. We are using node v6.10.3, a stable version can build as a library. It is specified in [embedded.js](https://github.com/Microsoft/napajs/blob/master/scripts/embedded.js) and [napa-runner CMakeLists.txt](https://github.com/Microsoft/napajs/blob/master/examples/tutorial/napa-runner/CMakeLists.txt). Please update both of them if you want to use a different version of Node/V8.
2. Go to directory of "examples/tutorial/napa-runner", and run "cmake-js build" to build napa runner
**NOTE**: Build solution of napa-runner is provided only for linux system so far. Windows / Mac OS support will come in near future.
## How to use
1. Run "npm install" to intall required npm modules
2. Run "./bin/napa-runner emstimate-PI.js"
1. Run "npm install" to install required npm modules
2. Run "./bin/napa-runner estimate-PI.js"

Просмотреть файл

@ -47,7 +47,7 @@ exports.build = function (buildType) {
}
else {
// TODO (asib): support other platforms
console.log("\x1b[1m\x1b[32m", "Napa build solution for embeded mode is not provided for ", os.platform(),'\x1b[0m');
console.log("\x1b[1m\x1b[32m", "Napa build solution for embedded mode is not provided for ", os.platform(),'\x1b[0m');
return;
}