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
/* | |
Lesson: | |
Wrapping it all up into a struct & impl. | |
*/ | |
struct BubbleSort; | |
impl BubbleSort { | |
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
struct Helper<T> { | |
field1: T | |
} | |
impl<T> Helper<T> { | |
fn new (foo: T) -> Helper<T> { | |
Helper { field1: foo } | |
} | |
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
struct Helper { | |
field1: u64 | |
} | |
impl Helper { | |
fn new (foo: u64) -> Helper { | |
Helper { field1: foo } | |
} | |
fn bit_set (&self, bit: u64) -> bool { |
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
cremes$ rustc --test vec.rs | |
vec.rs:4362:12: 4362:17 error: expected `{` or `mod` but found `crate` | |
vec.rs:4362 extern crate test; |
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
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! |
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
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 |
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
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] |
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
# before | |
def reset! | |
@start = @used = 0 | |
@eof = false | |
@write_synced = true | |
end | |
def discard(skip) | |
while @start < @used |
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
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') |
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
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') |
OlderNewer