Reference read
Perf: $ time target/release/fast-fantoir FANTOIR0721 real 0m0,608s user 0m0,526s sys 0m0,081s $ time target/debug/fast-fantoir FANTOIR0721 real 0m11,664s user 0m11,549s sys 0m0,113s I highly suspect the release build to optimize out the useless file read, partially explaining the *MASSIVE* perf difference between the release build and the debug one. This gives up a baseline speed order though. We should probably be able to stay below 1 minute to generate the DB.
This commit is contained in:
commit
e39f94bd25
|
@ -0,0 +1 @@
|
||||||
|
/target
|
|
@ -0,0 +1,7 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fast-fantoir"
|
||||||
|
version = "0.1.0"
|
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "fast-fantoir"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
|
@ -0,0 +1,5 @@
|
||||||
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
|
||||||
|
pkgs.mkShell {
|
||||||
|
nativeBuildInputs = [ pkgs.rustc pkgs.cargo ];
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::{BufReader, BufRead};
|
||||||
|
|
||||||
|
fn main() -> std::io::Result<()> {
|
||||||
|
let fantoir_path = std::env::args().nth(1).unwrap();
|
||||||
|
let file = match File::open(&fantoir_path) {
|
||||||
|
Err(err) => panic!("Cannot read file {}: {}", fantoir_path, err),
|
||||||
|
Ok(file) => file,
|
||||||
|
};
|
||||||
|
let reader = BufReader::new(file);
|
||||||
|
|
||||||
|
for line in reader.lines() {
|
||||||
|
match line {
|
||||||
|
Ok(_l) => (),
|
||||||
|
Err(err) => panic!("Cannot read line: {}", err),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Ok(())
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
Loading…
Reference in New Issue