-
Notifications
You must be signed in to change notification settings - Fork 742
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: Improve DependencyProperty propagation
- Remove linq usage in GetChildrenDependencyObjects - Use HashTableEx in dependency property inheritance propagation to avoid JIT costs and improve lookup performance.
- Loading branch information
1 parent
5f50f1f
commit ea6381e
Showing
3 changed files
with
74 additions
and
14 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
src/Uno.UI/UI/Xaml/DependencyObjectStore.AncestorsDictionary.cs
This file contains 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,54 @@ | ||
#nullable enable | ||
|
||
using System; | ||
using Uno.UI.DataBinding; | ||
using System.Collections.Generic; | ||
using Uno.Extensions; | ||
using Uno.Logging; | ||
using Uno.Diagnostics.Eventing; | ||
using Uno.Disposables; | ||
using System.Linq; | ||
using System.Threading; | ||
using Uno.Collections; | ||
using System.Runtime.CompilerServices; | ||
using System.Diagnostics; | ||
using Windows.UI.Xaml.Data; | ||
using Uno.UI; | ||
using System.Collections; | ||
|
||
#if XAMARIN_ANDROID | ||
using View = Android.Views.View; | ||
#elif XAMARIN_IOS_UNIFIED | ||
using View = UIKit.UIView; | ||
#elif XAMARIN_IOS | ||
using View = MonoTouch.UIKit.UIView; | ||
#endif | ||
|
||
namespace Windows.UI.Xaml | ||
{ | ||
public partial class DependencyObjectStore : IDisposable | ||
{ | ||
private class AncestorsDictionary | ||
{ | ||
private readonly HashtableEx _entries = new HashtableEx(); | ||
|
||
internal bool TryGetValue(object key, out bool isAncestor) | ||
{ | ||
if (_entries.TryGetValue(key, out var value)) | ||
{ | ||
isAncestor = (bool)value!; | ||
return true; | ||
} | ||
|
||
isAncestor = false; | ||
return false; | ||
} | ||
|
||
internal void Set(object key, bool isAncestor) | ||
=> _entries[key] = isAncestor; | ||
|
||
internal void Clear() | ||
=> _entries.Clear(); | ||
} | ||
} | ||
} |
This file contains 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 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