User avatar
aliagha.huseynli
Topic Author
Posts: 44
Joined: 29 Mar 2023, 10:17

view.Content.FindName performance impact

13 Dec 2023, 12:08

Hi Noesis Team,

I use a lot from FindName to get any element in XAML.
If I use over 50 or more of this code will I face any performance issues in my Unity project?
private TextBlock TextBlock1;

void Start
{
NoesisView view = GetComponent<NoesisView> ();
view.Content.DataContext = this;
TextBlock1 = view.Content.FindName (nameof (TextBlock1)) as TextBlock;
}
 
User avatar
sfernandez
Site Admin
Posts: 3008
Joined: 22 Dec 2011, 19:20

Re: view.Content.FindName performance impact

14 Dec 2023, 10:35

Calling FindName on the the View.Content will be a pretty fast operation because the lookups are done on a map that is stored in the Content element. So you shouldn't have any performance issues because of this.

Have you found any trouble with it?
 
User avatar
jsantos
Site Admin
Posts: 3939
Joined: 20 Jan 2012, 17:18
Contact:

Re: view.Content.FindName performance impact

14 Dec 2023, 13:12

Just a note for future readers, although FindName is a fast operation, we don't recommend doing it per frame.
 
User avatar
aliagha.huseynli
Topic Author
Posts: 44
Joined: 29 Mar 2023, 10:17

Re: view.Content.FindName performance impact

15 Dec 2023, 06:22

No, I didn't find any problem with it. I just want to make sure about it. Thanks a lot :)

Who is online

Users browsing this forum: Ahrefs [Bot] and 6 guests