Skip to content

Commit 37a56ad

Browse files
author
Your Name
committed
Changes to walk the shorter index first
1 parent 115d4a9 commit 37a56ad

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rbase"
3-
version = "0.1.4"
3+
version = "0.1.5"
44
edition = "2021"
55
repository = "https://github.com/WorksButNotTested/rbase.git"
66
authors = [ "WorksButNotTested" ]

src/base.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ impl<
3131
> Base<T>
3232
{
3333
fn get_base_addresses(strings: &Strings<T>, addresses: &Addresses<T>) -> DashMap<T, usize> {
34-
let list = addresses.get_addresses();
35-
let pb = Progress::get("Collecting candidate base addresses", list.len());
34+
let strs = strings.get_strings();
35+
let addrs = addresses.get_addresses();
36+
let pb = Progress::get("Collecting candidate base addresses", strs.len());
3637
let map = DashMap::<T, usize>::new();
37-
list.par_iter().progress_with(pb).for_each(|r| {
38-
let (offset, addresses) = r.pair();
39-
if let Some(strings) = strings.get().get(offset) {
38+
strs.par_iter().progress_with(pb).for_each(|r| {
39+
let (offset, strings) = r.pair();
40+
if let Some(addresses) = addrs.get(offset) {
4041
for &s in strings.deref() {
4142
for &a in addresses.deref() {
4243
if a > s {

src/strings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl<
9494
return Self { index };
9595
}
9696

97-
pub fn get(&self) -> &DashMap<T, Vec<T>> {
97+
pub fn get_strings(&self) -> &DashMap<T, Vec<T>> {
9898
return &self.index;
9999
}
100100
}

0 commit comments

Comments
 (0)