This file contains hidden or 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
// XML parsing adventure | |
#![license = "MIT"] | |
#![feature(phase)] | |
// extern crate simhash; | |
#[phase(plugin)] | |
extern crate peg_syntax_ext; |
This file contains hidden or 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
#[macro_use] | |
extern crate nickel; | |
extern crate yaml_rust; | |
use nickel::{ Nickel, HttpRouter }; | |
use yaml_rust::{ Yaml, YamlEmitter }; | |
mod yaml_handler; | |
fn get_yaml() -> String { |
This file contains hidden or 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
use std::cmp::Ordering; | |
use std::fmt::Debug; | |
extern crate scoped_pool; | |
use scoped_pool::{Pool, Scope}; | |
/// An insertion sort for small slices | |
#[inline] | |
fn insertion_sort<T>(arr: &mut [T], left: usize, right: usize) where T: Ord { |
This file contains hidden or 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
use std::io::stdin; | |
use std::io::Read; | |
use std::rc::Rc; | |
use std::cell::RefCell; | |
use std::cmp::max; | |
#[derive(Debug, Copy, Clone)] | |
struct Position(u16, u16); | |
impl Position { | |
fn adjacent(&self, other: &Position) -> bool { | |
max((self.0 as i16 - other.0 as i16).abs(), (self.1 as i16 - other.1 as i16).abs()) <= 1 |
This file contains hidden or 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
impl<T: Transport> BufferedTransport<T> { | |
fn get_bytes(&mut self) -> io::Result<&[u8]> { | |
if self.rpos == self.rbuf.len() { | |
self.rpos = 0; | |
self.rcap = try!(self.underlying.read(&mut self.rbuf)); | |
} | |
Ok(&self.rbuf[self.rpos..self.rcap]) | |
} |
This file contains hidden or 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
bench: libauthz.so | |
python2 main.py | |
libauthz.so: rusty_authz.rs Makefile | |
rustc -C opt-level=3 -C lto rusty_authz.rs --crate-type cdylib -o libauthz.so | |
.PHONY: bench |
This file contains hidden or 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(libc)] | |
#![feature(test)] | |
extern crate libc; | |
extern crate test; | |
extern crate seahash; | |
use std::slice; | |
use std::ffi::CStr; | |
use std::panic; | |
use std::str; |
This file contains hidden or 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(const_fn)] | |
// rust self-tracing benchmark using DebugCtl.BTF | |
extern crate winapi; | |
extern crate kernel32; | |
extern crate libc; | |
use std::time::Instant; |
This file contains hidden or 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
inside: TreeIterator { current: Tree { nodes: [None, None] }, depth: 0 } | |
Got out Tree { nodes: [None, None] } | |
After first inc(0) Tree { nodes: [None, None] } | |
After second inc(1) Tree { nodes: [Some(Tree { nodes: [None, None] }), None] } | |
next tree: Some(Tree { nodes: [None, None] }) | |
inside: TreeIterator { current: Tree { nodes: [Some(Tree { nodes: [None, None] }), None] }, depth: 1 } | |
Got out Tree { nodes: [Some(Tree { nodes: [None, None] }), Some(Tree { nodes: [None, None] })] } | |
After first inc(1) Tree { nodes: [Some(Tree { nodes: [None, None] }), Some(Tree { nodes: [None, None] })] } | |
next tree: Some(Tree { nodes: [Some(Tree { nodes: [None, None] }), Some(Tree { nodes: [None, None] })] }) | |
inside: TreeIterator { current: Tree { nodes: [Some(Tree { nodes: [None, None] }), Some(Tree { nodes: [None, None] })] }, depth: 1 } |
OlderNewer