https://github.com/playerx/deno-rust-plugin
How to write Rust plugin for Deno & performance benchmark for one custom plugin Op call
https://github.com/playerx/deno-rust-plugin
Last synced: about 1 month ago
JSON representation
How to write Rust plugin for Deno & performance benchmark for one custom plugin Op call
- Host: GitHub
- URL: https://github.com/playerx/deno-rust-plugin
- Owner: playerx
- Created: 2020-07-28T20:13:17.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-29T09:56:09.000Z (almost 6 years ago)
- Last Synced: 2025-02-24T14:27:02.418Z (over 1 year ago)
- Language: TypeScript
- Size: 7.81 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Goals
This demo project had multiple goals:
1. Demonstrate how to write custom Rust Plugin and call it from Typescript
2. How to call Sync & Async functions in Rust from Typescript
3. See how much performance overhead it takes to call pure empty function in Rust and return the result back to Typescript
## Requirements
- [Rust](https://www.rust-lang.org/tools/install)
- [Deno](https://deno.land/#installation)
## How to run
1. `make`
2. `make run` or `deno run --allow-plugin --unstable --allow-hrtime mod.ts`
## Performance
Hardware:
```
MacBook Pro (Retina, 15-inch, Mid 2014)
2.2 GHz Quad-Core Intel Core i7
16 GB 1600 MHz DDR3
```
```
100000 Iterations
```
**Result:**
1 custom (sync) op call duration
| Avg | Fastest |
| ------ | ------- |
| 9820ns | 6649ns |
## Related
[nodejs-cpp-binding](https://github.com/playerx/nodejs-cpp-binding)