I hereby claim:
- I am tilpner on github.
- I am tilpner (https://keybase.io/tilpner) on keybase.
- I have a public key whose fingerprint is DEEA E3CB ABED 5094 9255 CDC2 4D79 DB6D BB81 7349
To claim this, I am signing this object:
#!/bin/sh | |
code/rust/x86_64-unknown-linux-gnu/stage2/bin/rustc --emit=llvm-ir -O standalone.rs | |
code/rust/x86_64-unknown-linux-gnu/llvm/Release/bin/llc standalone.ll | |
clang -o standalone standalone.s | |
./standalone |
#![no_std] | |
#![feature(libc, lang_items, start)] | |
#![no_main] | |
//! ```sh | |
//! # compile | |
//! rustc -C opt-level=3 -C no-stack-check standalone.rs | |
//! # strip | |
//! strip -sR .comment -R .gnu.hash -R .gnu.version -R .note.ABI-tag -R .note.gnu.build-id standalone | |
//! # check size |
I hereby claim:
To claim this, I am signing this object:
use std::ptr; | |
use std::cell::UnsafeCell; | |
use std::ops::Deref; | |
// Inline definition of anonymous functions. Examples: | |
// l!(42;) | |
// l!(i32 := 42) | |
// l!(i: i32 := i + 42) | |
// l!(i: i32, j: i32 -> i32 := i + j) | |
#[macro_export] |
[package] | |
name = "read_by_line" | |
version = "0.0.1" | |
authors = ["Till Hoeppner <till@hoeppner.ws>"] |
use std::env; | |
use std::fs::File; | |
use std::io::{ BufReader, BufRead }; | |
fn main() { | |
let file = File::open(env::args().nth(1).expect("Must supply one argument")) | |
.ok().expect("Couldn't open file"); | |
let input = BufReader::new(file); | |
for line in input.lines() { | |
match line { |
fn once(f: Box<Fn()>) { f() } | |
fn twice(f: fn()) { f(); f() } | |
fn thrice<F: Fn()>(f: F) { f(); f(); f() } | |
// Inline definition of anonymous functions. Examples: | |
// l!(42;) | |
// l!(i32 := 42) | |
// l!(i: i32 := i + 42) |
use std::fs::File; | |
use std::io::{ Read, BufRead, BufReader }; | |
fn main() { | |
let filename = "text.txt"; | |
let f = BufReader::new(File::open(filename).ok().expect("Failed to open file.")); | |
for line in f.lines() { | |
println!("{}", line.ok().expect("IO Error, couldn't read line.") |
#![feature(test)] | |
/// rustc --test -C opt-level=3 fragmentation.rs | |
/// ./fragmentation --bench | |
extern crate test; | |
use test::{ black_box, Bencher }; | |
use std::iter::repeat; | |
use std::borrow::Cow::{ self, Owned, Borrowed }; |
Running target/release/fragmentation-044547b832409c71 | |
running 4 tests | |
test bench_cows_best_case ... bench: 15 ns/iter (+/- 1) | |
test bench_cows_worst_case ... bench: 150 ns/iter (+/- 11) | |
test bench_fragmented ... bench: 133 ns/iter (+/- 2) | |
test bench_reduced_fragmentation ... bench: 41 ns/iter (+/- 2) | |
test result: ok. 0 passed; 0 failed; 0 ignored; 4 measured |