-
Notifications
You must be signed in to change notification settings - Fork 258
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
[NUI] Do not call default creator when we set value #5863
Conversation
Hello @elishateng @AdunFang. I'd like to check whether this way to fix is looks okay. To support it correctly, we'd better add some flag something like Could you check whether this PR has no problem even if we use XAML cases?
|
Hi Mr. Hong, public static readonly BindableProperty TextProperty = BindableProperty.Create(nameof(Text), typeof(string), typeof(TextLabel), string.Empty, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
{
var textLabel = (TextLabel)bindable;
if (newValue is Selector<string> selector)
{
textLabel.TextSelector = selector;
}
else
{
textLabel.selectorData?.Text?.Reset(textLabel);
textLabel.SetText((string)newValue);
}
}),
defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
{
var textLabel = (TextLabel)bindable;
// Do not try to get string if we know that previous text was empty.
return textLabel.textIsEmpty ? "" : Object.InternalGetPropertyString(textLabel.SwigCPtr, TextLabel.Property.TEXT);
})); This is the result of my talk with Mr. Fang, let’s take TextProperty as an example:
|
"ALL" default BindableProperty.PropertyChanged events what NUI using, dont use 'oldValue'. But due to that usecase, we always call DefaultValueCreator when we try to set value. To make NUI platform faster, let we ignore that property getter when we only use setter. For XMAL case, support for backward stabilize, let we don't use this feature. Performance result for app Tizen.NUI.PerformanceTest |Creation Type|Before PR (ms)|After PR (ms)|Reduce Rate (1 - after / before)| |-------------|-------------|-------------|-------------| | 40 COLOR | 2.6657574074074066 | 2.19945 | 17.492492232 % | | 40 IMAGE | 1.9131259259259266 | 1.56895 | 17.99023897 % | | 40 TEXT | 7.013750000000001 | 6.103418518518519 | 12.979240513 % | | 40 ROUNDED COLOR | 3.342475925925925 | 2.8528203703703694 | 14.649486381 % | | 40 BORDER COLOR | 4.039824074074074 | 3.8768833333333332 | 4.033362289 % | | 40 ROUNDED BORDER COLOR | 4.641790740740741 | 4.230518518518518 | 8.860206011 % | | 40 BLUR COLOR | 2.7265814814814813 | 2.329972222222222 | 14.546026295 % | | 40 ROUNDED BLUR COLOR | 2.817055555555555 | 2.56367962962963 | 8.994353179 % | Signed-off-by: Eunki Hong <[email protected]>
0baab07
to
a43c00c
Compare
@elishateng Let we think about only But... If we call The review point of this patch is, we can ignore that This is the sample code for example,
Before this patch :
After this patch :
Please check this PR only for |
"ALL" default BindableProperty.PropertyChanged events what NUI using, dont use 'oldValue'. But due to that usecase, we always call DefaultValueCreator when we try to set value.
To make NUI platform faster, let we ignore that property getter when we only use setter.
For XMAL case, support for backward stabilize, let we don't use this feature.
Performance result for app
Tizen.NUI.PerformanceTest
(dali version : 2.3.5. Release, Execute on WSL server based on Ubuntu22.04, i7 dual core)