Skip to content

Instantly share code, notes, and snippets.

View chuckremes's full-sized avatar

Chuck Remes chuckremes

View GitHub Profile
/*
Lesson:
Wrapping it all up into a struct & impl.
*/
struct BubbleSort;
impl BubbleSort {
struct Helper<T> {
field1: T
}
impl<T> Helper<T> {
fn new (foo: T) -> Helper<T> {
Helper { field1: foo }
}
struct Helper {
field1: u64
}
impl Helper {
fn new (foo: u64) -> Helper {
Helper { field1: foo }
}
fn bit_set (&self, bit: u64) -> bool {
cremes$ rustc --test vec.rs
vec.rs:4362:12: 4362:17 error: expected `{` or `mod` but found `crate`
vec.rs:4362 extern crate test;
cremes$ x86_64-apple-darwin/stage2/bin/rustc --test src/libstd/lib.rs
src/libstd/path/posix.rs:701:32: 701:39 warning: unnecessary parentheses around assigned value, #[warn(unnecessary_parens)] on by default
src/libstd/path/posix.rs:701 let path = ($path);
^~~~~~~
src/libstd/path/posix.rs:698:9: 711:10 note: in expansion of t!
src/libstd/path/posix.rs:711:9: 711:30 note: expansion site
src/libstd/path/posix.rs:702:32: 702:39 warning: unnecessary parentheses around assigned value, #[warn(unnecessary_parens)] on by default
src/libstd/path/posix.rs:702 let join = ($join);
^~~~~~~
src/libstd/path/posix.rs:698:9: 711:10 note: in expansion of t!
cremes$ x86_64-apple-darwin/stage2/bin/rustc -L./x86_64-apple-darwin/rt/ --test src/libstd/lib.rs
src/libstd/vec.rs:4923:13: 4923:27 error: type `~[u64]` does not implement any method in scope named `smoothsort`
src/libstd/vec.rs:4923 v.smoothsort();
^~~~~~~~~~~~~~
error: aborting due to previous error
Total running time: 60.377214919000004s
index % time self children called name
----------------------------------------------------------
[1] 100.0 0.00 60.37 1 Rubinius::Loader#script [1]
0.00 60.37 1 Rubinius::CodeLoader.load_script [2]
0.00 0.00 1 IO.read
-------------------------------------------------------
0.00 60.37 1 Rubinius::Loader#script [1]
[2] 100.0 0.00 60.37 1 Rubinius::CodeLoader.load_script [2]
0.00 60.37 1 Rubinius::CodeLoader#load_script [3]
# before
def reset!
@start = @used = 0
@eof = false
@write_synced = true
end
def discard(skip)
while @start < @used
require 'benchmark'
require 'benchmark/ips'
small_file = File.join(File.dirname(__FILE__), 'small.txt')
medium_file = File.join(File.dirname(__FILE__), 'medium.txt')
large_file = File.join(File.dirname(__FILE__), 'large.txt')
# Open these before the actual benchmarks so we don't also benchmark
# File.open().
small_handle = File.open(small_file, 'r')
require 'benchmark'
require 'benchmark/ips'
small_file = File.join(File.dirname(__FILE__), 'small.txt')
medium_file = File.join(File.dirname(__FILE__), 'medium.txt')
large_file = File.join(File.dirname(__FILE__), 'large.txt')
# Open these before the actual benchmarks so we don't also benchmark
# File.open().
small_handle = File.open(small_file, 'r')