Merge pull request #1044 from Shnatsel/fnv-hash-map

tr: use FnvHashMap instead of default HashMap backed by SipHasher
This commit is contained in:
mpkh 2017-06-02 13:56:13 +00:00 committed by GitHub
commit ee9013215b
2 changed files with 4 additions and 3 deletions

View file

@ -10,6 +10,7 @@ path = "tr.rs"
[dependencies] [dependencies]
getopts = "*" getopts = "*"
bit-set = "*" bit-set = "*"
fnv = "*"
[dependencies.uucore] [dependencies.uucore]
path = "../uucore" path = "../uucore"

View file

@ -14,6 +14,7 @@
extern crate bit_set; extern crate bit_set;
extern crate getopts; extern crate getopts;
extern crate fnv;
#[macro_use] #[macro_use]
extern crate uucore; extern crate uucore;
@ -21,7 +22,7 @@ extern crate uucore;
use bit_set::BitSet; use bit_set::BitSet;
use getopts::Options; use getopts::Options;
use std::io::{stdin, stdout, BufRead, BufWriter, Write}; use std::io::{stdin, stdout, BufRead, BufWriter, Write};
use std::collections::HashMap; use fnv::FnvHashMap;
use expand::ExpandSet; use expand::ExpandSet;
@ -65,8 +66,7 @@ fn delete(set: ExpandSet, complement: bool) {
} }
fn tr<'a>(set1: ExpandSet<'a>, mut set2: ExpandSet<'a>) { fn tr<'a>(set1: ExpandSet<'a>, mut set2: ExpandSet<'a>) {
//let mut map = VecMap::new(); let mut map = FnvHashMap::default();
let mut map = HashMap::new();
let stdin = stdin(); let stdin = stdin();
let mut locked_stdin = stdin.lock(); let mut locked_stdin = stdin.lock();
let mut buffered_stdout = BufWriter::new(stdout()); let mut buffered_stdout = BufWriter::new(stdout());