release mode vs debug

master
Andrew Johnson 6 years ago
parent 859c89b6fd
commit c30a4e35e6

@ -0,0 +1,12 @@
[package]
name = "Chapter9"
version = "1.0.0"
[dependencies]
cpuprofiler = "0.0.2"
flame = "0.2"
rand = "0.4.2"
[[bin]]
name = "performance_release_mode"
path = "performance_release_mode.rs"

@ -0,0 +1,4 @@
This chapter makes use of Google's [cpuprofiler](http://goog-perftools.sourceforge.net/doc/cpu_profiler.html),
which needs to be installed separately. It will not be installed through the normal cargo build process.
[GPerftools](https://github.com/gperftools/gperftools) is also available on Github.

@ -0,0 +1,20 @@
fn main() {
let mut res: Vec<Vec<u64>> = vec![vec![0; 512]; 512];
for _ in 0..50 {
for i in 1..511 {
for j in 1..511 {
res[j][i] = 2;
res[j][i] += res[j-1][i-1];
res[j][i] += res[j][i-1];
res[j][i] += res[j+1][i-1];
res[j][i] += res[j-1][i];
res[j][i] += res[j][i];
res[j][i] += res[j+1][i];
res[j][i] += res[j-1][i+1];
res[j][i] += res[j][i+1];
res[j][i] += res[j+1][i+1];
res[j][i] /= 9;
}
}
}
}
Loading…
Cancel
Save