chore(rust): Release 0.13.3
This commit is contained in:
parent
2d061579c8
commit
90b0cb089b
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Performance
|
||||||
|
|
||||||
|
- Optimize the loop implementation used for uniqueness check on short arrays.
|
||||||
|
|
||||||
## [0.13.3] - 2021-12-08
|
## [0.13.3] - 2021-12-08
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -199,7 +199,7 @@
|
||||||
"invalid": [
|
"invalid": [
|
||||||
{
|
{
|
||||||
"foo": 1,
|
"foo": 1,
|
||||||
"bar": 2
|
"bar": 2
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -917,7 +917,12 @@
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
"12": 12
|
"12": 12
|
||||||
}
|
},
|
||||||
|
13,
|
||||||
|
"14",
|
||||||
|
[
|
||||||
|
15
|
||||||
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"invalid": [
|
"invalid": [
|
||||||
|
@ -927,6 +932,10 @@
|
||||||
3,
|
3,
|
||||||
4,
|
4,
|
||||||
5,
|
5,
|
||||||
|
6,
|
||||||
|
7,
|
||||||
|
8,
|
||||||
|
9,
|
||||||
1
|
1
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
|
@ -57,7 +57,7 @@ impl Hash for HashedValue<'_> {
|
||||||
// Calculated for an array of mixed types, large homogenous arrays of primitive values might be
|
// Calculated for an array of mixed types, large homogenous arrays of primitive values might be
|
||||||
// processed faster with different thresholds, but this one gives a good baseline for the common
|
// processed faster with different thresholds, but this one gives a good baseline for the common
|
||||||
// case.
|
// case.
|
||||||
const ITEMS_SIZE_THRESHOLD: usize = 11;
|
const ITEMS_SIZE_THRESHOLD: usize = 15;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub(crate) fn is_unique(items: &[Value]) -> bool {
|
pub(crate) fn is_unique(items: &[Value]) -> bool {
|
||||||
|
@ -72,12 +72,16 @@ pub(crate) fn is_unique(items: &[Value]) -> bool {
|
||||||
} else if size <= ITEMS_SIZE_THRESHOLD {
|
} else if size <= ITEMS_SIZE_THRESHOLD {
|
||||||
// If the array size is small enough we can compare all elements pairwise, which will
|
// If the array size is small enough we can compare all elements pairwise, which will
|
||||||
// be faster than calculating hashes for each element, even if the algorithm is O(N^2)
|
// be faster than calculating hashes for each element, even if the algorithm is O(N^2)
|
||||||
for (idx, item) in items.iter().enumerate() {
|
let mut idx = 0_usize;
|
||||||
for other_item in items.iter().skip(idx + 1) {
|
while idx < items.len() {
|
||||||
if equal(item, other_item) {
|
let mut inner_idx = idx + 1;
|
||||||
|
while inner_idx < items.len() {
|
||||||
|
if equal(&items[idx], &items[inner_idx]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
inner_idx += 1;
|
||||||
}
|
}
|
||||||
|
idx += 1;
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue