Skip to content

Commit

Permalink
Update changelog before 0.4.2
Browse files Browse the repository at this point in the history
Also minor updates in docs and benchmarks.
  • Loading branch information
AngelicosPhosphoros committed Nov 15, 2023
1 parent 030106f commit 0fa9a10
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 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

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"
4 changes: 2 additions & 2 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"
criterion = "0.5"
rand = "0.8"
rand_chacha = "0.3"
fxhash = "0.2.1"
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
2 changes: 1 addition & 1 deletion 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 Down
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 0fa9a10

Please sign in to comment.