Skip to content

Instantly share code, notes, and snippets.

@Synatra
Created May 4, 2015 21:33
Show Gist options
  • Save Synatra/33929cc8c0800dc9739c to your computer and use it in GitHub Desktop.
Save Synatra/33929cc8c0800dc9739c to your computer and use it in GitHub Desktop.
Rust v Crystal
  • Specs: 512 mb RAM vps

#Results Command: wrk -c 64 -d 30s http://0.0.0.0:8000

CC: crystal test.cr --release

Running 30s test @ http://0.0.0.0:8000
  2 threads and 64 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    43.03us   97.90us   8.48ms   99.33%
    Req/Sec    22.54k     4.31k   25.21k    90.07%
  677540 requests in 30.04s, 51.69MB read
  Socket errors: connect 0, read 0, write 0, timeout 1
Requests/sec:  22552.49
Transfer/sec:      1.72MB

#Code

require "Moonshine/moonshine"
include Moonshine
include Moonshine::Shortcuts

app = Moonshine::App.new

# respond to all HTTP verbs
app.route "/", do |request|
	ok("Hello world")
end

app.run()
  • Specs: 512 mb RAM vps

#Results Command: wrk -c 64 -d 30s http://0.0.0.0:8000

CC: cargo run --release

Running 30s test @ http://0.0.0.0:8000
  2 threads and 64 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   126.30us   84.50us   9.88ms   93.02%
    Req/Sec    15.66k     3.02k   17.43k    86.00%
  467135 requests in 30.04s, 50.79MB read
Requests/sec:  15549.55
Transfer/sec:      1.69MB

#Code

extern crate iron;

use iron::prelude::*;
use iron::status;

fn main() {
    Iron::new(|_: &mut Request| {
        Ok(Response::with((status::Ok, "Hello world")))
    }).http("0.0.0.0:8000").unwrap();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment