-
-
Notifications
You must be signed in to change notification settings - Fork 350
perf(TreeView): improve cache for TreeViewNode #4677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
cdb4053
优化TreeView组件 虚拟滚动性能,更换List为HashSet,降低时间复杂度
kimdiego2098 4fee201
Merge branch 'main' into treeview_dev
ArgoZhang 73984d9
refactor: 重构代码
ArgoZhang 473d2ec
refactor: 使用主构造函数精简代码
ArgoZhang 8517101
refactor: 改用私有变量反射
ArgoZhang 99ed542
refactor: 增加 HashSetComparer 比较器
ArgoZhang 1969a8f
refactor: 重构节点缓存类
ArgoZhang 409c103
refactor: TreeView 组件更新比较器
ArgoZhang a6a1a78
refactor: Table 组件更新比较器
ArgoZhang d1f7f7c
refactor: 改造缓存类
ArgoZhang 24b8401
test: 更新单元测试
ArgoZhang 8608951
test: 补充 HashSetComparer 单元测试
ArgoZhang 33ba91f
refactor: 重命名比较器
ArgoZhang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the Apache 2.0 License | ||
// See the LICENSE file in the project root for more information. | ||
// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone | ||
|
||
namespace BootstrapBlazor.Components; | ||
|
||
/// <summary> | ||
/// 模型比较器 | ||
/// </summary> | ||
/// <typeparam name="TItem"></typeparam> | ||
public class ModelHashSetComparer<TItem>(IModelEqualityComparer<TItem> comparer) : IEqualityComparer<TItem> | ||
{ | ||
/// <summary> | ||
/// Equals 方法 | ||
/// </summary> | ||
/// <param name="x"></param> | ||
/// <param name="y"></param> | ||
/// <returns></returns> | ||
public bool Equals(TItem? x, TItem? y) => comparer.Equals(x, y); | ||
|
||
/// <summary> | ||
/// GetHashCode 方法 | ||
/// </summary> | ||
/// <param name="obj"></param> | ||
/// <returns></returns> | ||
public int GetHashCode([DisallowNull] TItem obj) | ||
{ | ||
var keyValue = Utility.GetKeyValue<TItem, object>(obj, comparer.CustomKeyAttribute); | ||
return keyValue?.GetHashCode() ?? obj.GetHashCode(); | ||
ArgoZhang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.