mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
perf: ⚡ improve Result hashcode algorithm (#2201)
This commit is contained in:
parent
cdff8fcd7c
commit
7b8f998065
1 changed files with 10 additions and 3 deletions
|
|
@ -172,9 +172,16 @@ namespace Flow.Launcher.Plugin
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
{
|
{
|
||||||
var hashcode = (Title?.GetHashCode() ?? 0) ^
|
unchecked
|
||||||
(SubTitle?.GetHashCode() ?? 0);
|
{
|
||||||
return hashcode;
|
// 17 and 23 are prime numbers
|
||||||
|
int hashcode = 17;
|
||||||
|
hashcode = hashcode * 23 + (Title?.GetHashCode() ?? 0);
|
||||||
|
hashcode = hashcode * 23 + (SubTitle?.GetHashCode() ?? 0);
|
||||||
|
hashcode = hashcode * 23 + (AutoCompleteText?.GetHashCode() ?? 0);
|
||||||
|
hashcode = hashcode * 23 + (CopyText?.GetHashCode() ?? 0);
|
||||||
|
return hashcode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue