-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(QueryAttribute): move out of the experimental namespace
BREAKING CHANGE: QueryAttribute has been moved from the UIComponents.Experimental namespace to UIComponents.
- Loading branch information
Showing
11 changed files
with
134 additions
and
59 deletions.
There are no files selected for viewing
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
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
67 changes: 67 additions & 0 deletions
67
Assets/UIComponents.Benchmarks/UIComponentFieldCacheBenchmarks.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,67 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
using UIComponents.Cache; | ||
using UIComponents.Experimental; | ||
using Unity.PerformanceTesting; | ||
using UnityEngine.UIElements; | ||
|
||
namespace UIComponents.Benchmarks | ||
{ | ||
public class UIComponentFieldCacheBenchmarks | ||
{ | ||
private class EmptyComponent : UIComponent {} | ||
|
||
private static void MeasureFieldCache<TComponent>() where TComponent : UIComponent | ||
{ | ||
Measure.Method(() => { new FieldCache(typeof(TComponent)); }) | ||
.SampleGroup(new SampleGroup("Time")) | ||
.MeasurementCount(100) | ||
.IterationsPerMeasurement(100) | ||
.GC() | ||
.Run(); | ||
} | ||
|
||
[Test, Performance, Version(BenchmarkUtils.Version)] | ||
public void InitializeEmptyComponent() | ||
{ | ||
MeasureFieldCache<EmptyComponent>(); | ||
} | ||
|
||
private class ComponentWithFields : UIComponent | ||
{ | ||
[Query("hello-world-label")] | ||
public readonly Label HelloWorldLabel; | ||
|
||
[Query(Name = "test-foldout")] | ||
public readonly Foldout TestFoldout; | ||
|
||
[Query] | ||
public readonly Label FirstLabel; | ||
|
||
[Query(Class = "text")] | ||
public readonly Label[] LabelsWithTextClass; | ||
|
||
[Query(Name = "hello-world-label", Class = "text")] | ||
public readonly Label HelloWorldLabelWithTextClass; | ||
|
||
[Query] | ||
public readonly List<Label> AllLabelsImplicit; | ||
|
||
[Query(Name = "hello-world-label")] | ||
[Query(Name = "foldout-content")] | ||
public readonly List<Label> AllLabelsExplicit; | ||
|
||
[Provide] | ||
public readonly IList StringProperty; | ||
[Provide] | ||
public readonly IList FloatProperty; | ||
} | ||
|
||
[Test, Performance, Version(BenchmarkUtils.Version)] | ||
public void InitializeComponentWithFields() | ||
{ | ||
MeasureFieldCache<ComponentWithFields>(); | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Assets/UIComponents.Benchmarks/UIComponentFieldCacheBenchmarks.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
File renamed without changes.
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