Skip to content

Commit

Permalink
Release 0.4.2
Browse files Browse the repository at this point in the history
* Minor doc changes
* Bump MSRV
* Bump version of indexmap crate
  • Loading branch information
AngelicosPhosphoros authored Nov 15, 2023
2 parents 8bef243 + 0fa9a10 commit 2656a97
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci_cross_platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- stable
- beta
- nightly
- 1.56.0 # MSRV
- 1.63.0 # MSRV
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
name: Setup rust toolchain
with:
profile: minimal
toolchain: nightly-2021-10-23
toolchain: nightly-2022-08-11
override: true
components: miri
- name: Run tests with Miri
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Change Log

## 2023-11-15: 0.4.2
- Update `indexmap` dependency to 2.1.0
- Update MSRV to 1.63 to be able to link `indexmap`

## 2021-10-24: 0.4.1
- Fixed Readme.md

## 2021-10-24: 0.4.0
- Update MSRV to Rust 0.56 and Rust 2021
- Add MSRV entry into Cargo.toml to make cargo check if Rust version compatible
- Switch from Travis.CI to GitHub Actions
- Add code from Readme.md to doctests to make it tested in CI

## 2021-02-21: 0.3.2
- Fixed bug in priority queue implementation.

Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ members = [
# Internal
"benches",
]
resolver = "2"
8 changes: 4 additions & 4 deletions benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ publish = false
keyed_priority_queue = { path = "../keyed_priority_queue" }

[dev-dependencies]
criterion = "0.3"
rand = "0.7"
rand_chacha = "0.2"
fxhash = "0.2.1"
criterion = "0.5"
rand = "0.8"
rand_chacha = "0.3"
rustc-hash = "1.1.0"

[[bench]]
name = "bench_push"
Expand Down
17 changes: 12 additions & 5 deletions benches/bench_a_star.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::cmp::Reverse;
use std::hash::BuildHasherDefault;
use std::ops::Index;

#[derive(Eq, PartialEq, Debug, Hash, Copy, Clone, Ord, PartialOrd)]
Expand Down Expand Up @@ -75,7 +76,7 @@ fn get_neighbors(pos: Position, field: &Field) -> Neighbours {

mod std_a_star {
use super::*;
use fxhash::{FxHashMap, FxHashSet};
use rustc_hash::{FxHashMap, FxHashSet};
use std::collections::BinaryHeap;

pub(crate) fn find_path(
Expand Down Expand Up @@ -153,8 +154,8 @@ mod std_a_star {

mod keyed_a_star {
use super::*;
use fxhash::{FxHashMap, FxHashSet};
use keyed_priority_queue::{Entry, KeyedPriorityQueue};
use rustc_hash::{FxHashMap, FxHashSet};
use std::hash::BuildHasher;

pub(crate) fn find_path<HasherParam: BuildHasher + Default>(
Expand Down Expand Up @@ -259,9 +260,11 @@ fn generate_field(size: usize) -> Field {
}

fn find_path_benchmark(c: &mut Criterion) {
use rustc_hash::FxHasher;

let field = generate_field(100);
let mut group = c.benchmark_group("A_Stars");
for &end in &[1, 5, 10, 25, 45, 49, 99] {
for &end in &[1, 5, 10, 25, 50, 100] {
let start = Position { row: 0, column: 0 };
let stop_at = Position {
row: end,
Expand All @@ -287,7 +290,9 @@ fn find_path_benchmark(c: &mut Criterion) {
BenchmarkId::new("Keyed A Star FxHash", end),
&(start, stop_at, &field),
|b, &(start, target, field)| {
b.iter(|| keyed_a_star::find_path::<fxhash::FxBuildHasher>(start, target, field))
b.iter(|| {
keyed_a_star::find_path::<BuildHasherDefault<FxHasher>>(start, target, field)
})
},
);
}
Expand Down Expand Up @@ -323,7 +328,9 @@ fn find_path_benchmark(c: &mut Criterion) {
BenchmarkId::new("Keyed A Star Ones field FxHash", BIG_SIZE),
&(start, stop_at, &field),
|b, _| {
b.iter(|| keyed_a_star::find_path::<fxhash::FxBuildHasher>(start, stop_at, &field_eq))
b.iter(|| {
keyed_a_star::find_path::<BuildHasherDefault<FxHasher>>(start, stop_at, &field_eq)
})
},
);

Expand Down
4 changes: 2 additions & 2 deletions benches/bench_get_priority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn bench_get_priority(c: &mut Criterion) {
}
queue
},
BatchSize::LargeInput,
BatchSize::SmallInput,
);
});
}
Expand Down Expand Up @@ -60,7 +60,7 @@ pub fn bench_get_priority(c: &mut Criterion) {
}
queue
},
BatchSize::LargeInput,
BatchSize::SmallInput,
);
});
}
Expand Down
4 changes: 2 additions & 2 deletions benches/bench_pop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn bench_pop(c: &mut Criterion) {
}
queue
},
BatchSize::LargeInput,
BatchSize::SmallInput,
);
});
}
Expand All @@ -54,7 +54,7 @@ pub fn bench_pop(c: &mut Criterion) {
}
queue
},
BatchSize::LargeInput,
BatchSize::SmallInput,
);
});
}
Expand Down
8 changes: 4 additions & 4 deletions benches/bench_push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub fn bench_push(c: &mut Criterion) {
}
queue
},
BatchSize::LargeInput,
BatchSize::SmallInput,
);
});
}
Expand Down Expand Up @@ -70,7 +70,7 @@ pub fn bench_push(c: &mut Criterion) {
}
queue
},
BatchSize::LargeInput,
BatchSize::SmallInput,
);
});
}
Expand Down Expand Up @@ -104,7 +104,7 @@ pub fn bench_push(c: &mut Criterion) {
}
queue
},
BatchSize::LargeInput,
BatchSize::SmallInput,
);
});
}
Expand Down Expand Up @@ -140,7 +140,7 @@ pub fn bench_push(c: &mut Criterion) {
}
queue
},
BatchSize::LargeInput,
BatchSize::SmallInput,
);
});
}
Expand Down
4 changes: 2 additions & 2 deletions benches/bench_remove_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub fn bench_remove_item(c: &mut Criterion) {
}
queue
},
BatchSize::LargeInput,
BatchSize::SmallInput,
);
});
}
Expand Down Expand Up @@ -58,7 +58,7 @@ pub fn bench_remove_item(c: &mut Criterion) {
}
queue
},
BatchSize::LargeInput,
BatchSize::SmallInput,
);
});
}
Expand Down
4 changes: 2 additions & 2 deletions benches/bench_set_priority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub fn bench_set_priority(c: &mut Criterion) {
}
(queue, results_store)
},
BatchSize::LargeInput,
BatchSize::SmallInput,
);
});
}
Expand Down Expand Up @@ -72,7 +72,7 @@ pub fn bench_set_priority(c: &mut Criterion) {
}
(queue, results_store)
},
BatchSize::LargeInput,
BatchSize::SmallInput,
);
});
}
Expand Down
6 changes: 3 additions & 3 deletions keyed_priority_queue/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "keyed_priority_queue"
version = "0.4.1"
version = "0.4.2"
authors = ["AngelicosPhosphoros <[email protected]>"]
edition = "2021"
description = "Priority queue that support changing priority or early remove by key"
Expand All @@ -10,9 +10,9 @@ categories = ["data-structures"]
keywords = ["priority", "queue", "keyed", "binary", "heap"]
repository = "https://github.com/AngelicosPhosphoros/keyed_priority_queue"
documentation = "https://docs.rs/keyed_priority_queue"
rust-version = "1.56"
rust-version = "1.63"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
indexmap = "^1.3"
indexmap = "2.1.0"
8 changes: 4 additions & 4 deletions keyed_priority_queue/src/keyed_priority_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ use crate::mediator::{
/// It is logic error if key values changes somehow while in queue.
/// This changes normally possible only through `Cell`, `RefCell`, global state, IO, or unsafe code.
///
/// If you feel KeyedPriorityQueue slow, it can be because it uses RandomState (relatably slow but strong against HashDoS attack) hasher by default.
/// You can try [fnv] or [fxhash] crates hashers.
/// If you feel KeyedPriorityQueue slow, it can be because it uses RandomState (slightly slow but strong against HashDoS attack) hasher by default.
/// For example, you may try [fnv] or [rustc-hash] crates hashers.
///
/// [`set_priority`]: struct.KeyedPriorityQueue.html#method.set_priority
/// [fnv]: https://crates.io/crates/fnv
/// [fxhash]: https://crates.io/crates/fxhash
/// [rustc-hash]: https://crates.io/crates/rustc-hash
///
/// # Examples
///
Expand Down Expand Up @@ -52,7 +52,7 @@ use crate::mediator::{
///
/// // We can run consuming iterator on queue,
/// // and it will return items in decreasing order
/// for (key, priority) in queue_clone{
/// for (key, priority) in queue_clone {
/// println!("Priority of key {} is {}", key, priority);
/// }
///
Expand Down

0 comments on commit 2656a97

Please sign in to comment.