Skip to content

Instantly share code, notes, and snippets.

@mfpiccolo
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfpiccolo/84b649a5a67ca54e1f66 to your computer and use it in GitHub Desktop.
Save mfpiccolo/84b649a5a67ca54e1f66 to your computer and use it in GitHub Desktop.
#![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));
}
[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