hi
i just encounter a really weird behavior. i am not sure it is related to the new update or not.
so what i did is adding each letter in a specific text to a clv.
i add only a single view. it is a label.
i made some speed test and i had big differences between 2 methods.
method 1:
so i create inside the function a nativelabel and reference it to a b4xview.
this method works fine and fast.
then i tried to add the label from a outside function to be able to use it again.
like this:
this method took much longer (x50 longer)
1. method (in debug mode) 80ms
2. method (in debug mode) 4000ms
so first i thought it has something to do with creating the label from outside BUT accidentally i changed the outside method to NOT use the passed variable and it took the same time as the 1 method like this:
as you can see EVENT is not used and it takes now only 80 ms as the first method. why is it like this that if i used the passed object it takes 50x longer to create this clv than not using the passed object??
logs:
(example included)
i just encounter a really weird behavior. i am not sure it is related to the new update or not.
so what i did is adding each letter in a specific text to a clv.
i add only a single view. it is a label.
i made some speed test and i had big differences between 2 methods.
method 1:
B4X:
Private Sub createitem1(i As Int, width As Float, height As Float) As B4XView
Dim p As B4XView = xui.CreatePanel("")
p.Color = xui.Color_White
p.Width = width
p.Height = height
Dim natLbl As Label
natLbl.Initialize("")
Dim lbl As B4XView = natLbl
lbl.Text = "item: " & i
lbl.TextColor = xui.Color_ARGB(255,Rnd(0,255),Rnd(0,255),Rnd(0,255))
lbl.SetTextAlignment("CENTER","CENTER")
p.AddView(lbl,0,0,width, height)
Return p
End Sub
so i create inside the function a nativelabel and reference it to a b4xview.
this method works fine and fast.
then i tried to add the label from a outside function to be able to use it again.
like this:
B4X:
Private Sub createitem2(i As Int, width As Float, height As Float) As B4XView
Dim p As B4XView = xui.CreatePanel("")
p.Color = xui.Color_White
p.Width = width
p.Height = height
Dim lbl As B4XView = createLabel("")
lbl.Text = "item: " & i
lbl.TextColor = xui.Color_ARGB(255,Rnd(0,255),Rnd(0,255),Rnd(0,255))
lbl.SetTextAlignment("CENTER","CENTER")
p.AddView(lbl,0,0,width, height)
Return p
End Sub
Private Sub createLabel(event As String) As B4XView
Dim natLbl As Label
natLbl.Initialize(event)
Return natLbl
End Sub
this method took much longer (x50 longer)
1. method (in debug mode) 80ms
2. method (in debug mode) 4000ms
so first i thought it has something to do with creating the label from outside BUT accidentally i changed the outside method to NOT use the passed variable and it took the same time as the 1 method like this:
B4X:
Private Sub createLabel(event As String) As B4XView
Dim natLbl As Label
natLbl.Initialize("")
Return natLbl
End Sub
as you can see EVENT is not used and it takes now only 80 ms as the first method. why is it like this that if i used the passed object it takes 50x longer to create this clv than not using the passed object??
logs:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
6495 ms
82 ms
70 ms
(example included)