Skip to content

Commit

Permalink
Merge pull request #3 from heyinc/update_docs
Browse files Browse the repository at this point in the history
Update docs
  • Loading branch information
White-Green authored Jul 28, 2023
2 parents d852631 + d1f3bcd commit b3d66dc
Show file tree
Hide file tree
Showing 10 changed files with 363 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
!/.github
!/bin
!/lib
!/doc_resources
!/test
!/.gitignore
!/.rubocop.yml
Expand All @@ -10,4 +11,4 @@
!/Gemfile
!/LICENSE.txt
!/Rakefile
!/README.md
!/README.md
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ Accelerated ExecJS Runtime by launching Node.js Processes per Context, not per e

inspired by [execjs-fastnode](https://github.com/jhawthorn/execjs-fastnode)

## How PCRuntime fast?

The existing Node.js runtime spawns a Node.js process for each eval, regardless of whether it compiles or not.
To reduce this overhead, execjs-fastnode is designed to launch a single Node.js process and manage the Context in JavaScript.

| Node.js | execjs-fastnode |
|:-------------------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------------------------:|
| ![Sequence Diagram of Node.js Runtime](./doc_resources/out/sequence_nodejs/sequence_nodejs.svg) | ![Sequence Diagram of FastNode Runtime](./doc_resources/out/sequence_fastnode1/sequence_fastnode1.svg) |

execjs-fastnode is designed to limit the number of threads that can access a Node.js process to 1 to avoid the race condition when multiple Contexts are used.
execjs-pcruntime works lock-free by creating a Node.js process for each Context.
This improves performance when used with multi-threading.

| execjs-fastnode(multi-threading) | execjs-pcruntime |
|:-------------------------------------------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------:|
| ![Sequence Diagram of FastNode Runtime in multi-threading](./doc_resources/out/sequence_fastnode2/sequence_fastnode2.svg) | ![Sequence Diagram of PCRuntime](./doc_resources/out/sequence_pcruntime/sequence_pcruntime.svg) |

## Requirements

- Ruby >= 3.0.0
Expand Down
35 changes: 35 additions & 0 deletions doc_resources/out/sequence_fastnode1/sequence_fastnode1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 70 additions & 0 deletions doc_resources/out/sequence_fastnode2/sequence_fastnode2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions doc_resources/out/sequence_nodejs/sequence_nodejs.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b3d66dc

Please sign in to comment.