Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

hackjoy/embedded_rust

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Embedded Rust

Calls Rust code from within Ruby using Foreign Function Interface (FFI).

The task:

Start ten threads. Inside each thread, count from one to five million. After All ten threads are finished, print out ‘done!’.

Installation

You may need to gem install ffi before running the example.

Running the example

Run ruby embed.rb from the command line and you should see the comparison between Embedded Rust called from within Ruby and a pure Ruby implementation of the above task.

Sample result

user     system      total        real
Embedded Rust
0.000000   0.000000   0.000000 (  0.000584)

user     system      total        real
Pure Ruby
2.730000   0.000000   2.730000 (  2.732160)

About

Embedding Rust within Ruby

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.