Last active
August 29, 2015 14:25
-
-
Save mfpiccolo/84b649a5a67ca54e1f66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(test)] | |
extern crate hyper; | |
extern crate test; | |
use hyper::Client; | |
use std::io::Read; | |
extern crate time; | |
#[no_mangle] | |
pub extern fn run_threads() { | |
let start_time = time::now(); | |
for i in 0..5 { | |
let client = Client::new(); | |
println!("Requesting {}", i.to_string()); | |
let mut response = client.get("http://wikipedia.com/").send().unwrap(); | |
let mut body = String::new(); | |
response.read_to_string(&mut body).unwrap(); | |
println!("BodyLength: {}", body.len().to_string()); | |
} | |
let end_time = time::now(); | |
println!("{:?}", (end_time - start_time)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "scrape" | |
version = "0.1.0" | |
authors = ["Mike Piccolo <email@gmail.com>"] | |
[lib] | |
name = "scrape" | |
crate-type = ["dylib"] | |
[dependencies.hyper] | |
git = "https://github.com/hyperium/hyper.git" | |
[dependencies] | |
time = "0.1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment