Browse Source

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.
fastestest
Félix Baylac-Jacqué 7 months ago
commit
e39f94bd25
Signed by: NinjaTrappeur
GPG Key ID: EFD315F31848DBA4
  1. 1
      .gitignore
  2. 7
      Cargo.lock
  3. 8
      Cargo.toml
  4. 5
      shell.nix
  5. 19
      src/main.rs
  6. 3
      src/main.rs~

1
.gitignore vendored

@ -0,0 +1 @@
/target

7
Cargo.lock generated

@ -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"

8
Cargo.toml

@ -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]

5
shell.nix

@ -0,0 +1,5 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
nativeBuildInputs = [ pkgs.rustc pkgs.cargo ];
}

19
src/main.rs

@ -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(())
}

3
src/main.rs~

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
Loading…
Cancel
Save