An open API service indexing awesome lists of open source software.

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

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)