B4J Question [ABMaterial] ABMCanvas

Harris

Expert
Licensed User
Longtime User
This has been driving me crazy for the past 2 days! I should just leave it alone but to anal to do so.
Each time a render a graph (PaintLog) with a collection of values, it takes longer and longer each time (as the log file shows).

Eventually, I call clog.Refresh - where the delay compounds...

By the time I get to the 30th item, it takes about 5 seconds for the series of lines to paint.
Hitting the browser refresh button is the only way to restore the speed (which restores everything).

Any Suggestions?
Thanks


The logs file...
B4X:
Start draw dlog
End draw dlog: 859 ms

Start draw dlog
End draw dlog: 915 ms

Start draw dlog
End draw dlog: 997 ms

Start draw dlog
End draw dlog: 1050 ms


B4X:
Sub PaintLog(stats As List)
  
Dim clog As ABMCanvas  = page.Component("canvasLog")

dlog.Clear
dlog.clearRect(0,0,dlwdt,dlhgt)
clog.RemoveObject("dlog")

Dim ty,tx  As Double
ty = y
tx = x

y = ty
x = tx

Dim wdt As Int = 0.9
Dim hgt As Int =  15
Dim cstat As Int
Dim tof,tsb,tdr,ton As Int


dlog.strokeStyleColor("#000000")
y =  offy + y - (hgt/2)
x =  lbuff -3

stim = DateTime.Now
Log("Start draw dlog")

For i = 0 To stats.Size-1

    cstat = stats.Get(i)
  
    Select cstat
        Case 1
            dlog.beginPath
            dlog.moveTo(x+i,  y)
            dlog.lineTo(x+i, y+hgt)  
            tof = tof +1
            dlog.closePath
            dlog.stroke
          
        Case 2
            dlog.beginPath
            dlog.moveTo(x+i,  y+(lbuff))
            dlog.lineTo(x+i, y+(lbuff)+hgt)  
            tsb = tsb +1
            dlog.closePath
            dlog.stroke
          
        Case 3
            dlog.beginPath
            dlog.moveTo(x+i,  y+(lbuff*2))
            dlog.lineTo(x+i, y+(lbuff*2)+hgt)  
            tdr = tdr +1
            dlog.closePath
            dlog.stroke
          
        Case 4
            dlog.beginPath
            dlog.moveTo(x+i,  y+(lbuff*3))
            dlog.lineTo(x+i, y+(lbuff*3)+hgt)  
            ton = ton +1
            dlog.closePath
            dlog.stroke
          
    End Select
Next

y = ty
x = tx

dlog.fillStyleColor(ABM.COLOR_BLUE)

y =  offy + y - (hgt/2)+7

x =  lbuff -7

'y = y + lbuff
dlog.fillText(ABMShared.ShowTimeFormatMins(tof),x+rectw+(lbuff/1.5),y)

y = y + lbuff
dlog.fillText(ABMShared.ShowTimeFormatMins(tsb),x+rectw+(lbuff/1.5),y)

y = y + lbuff
dlog.fillText(ABMShared.ShowTimeFormatMins(tdr),x+rectw+(lbuff/1.5),y)

y = y + lbuff
dlog.fillText(ABMShared.ShowTimeFormatMins(ton),x+rectw+(lbuff/1.5),y)

clog.AddObject(dlog)

y = ty
x = tx  

End Sub
 

Harris

Expert
Licensed User
Longtime User
Sounds like a memory leak in the ABMCanvas component. Is it still the case if you do not remove/add the dlog object every time?

And just so I'm not chasing ghosts, you are sure the list is always emptied before adding the new batch?
Explain above and I shall try... (with code from my attempt)

I can send you the project and you can see WTF is happening. No need for DB, you can connect to my many test servers.

I clear, I re-Init, I do everything I could think of and it still grinds down. Weird for sure.

I know you have much more (important items) on your plate to accomplish this weekend, so I wish not to distract you at this time.

Thanks
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
I'll try to continue on the website for the choir this weekend and I'll focus first on the login stuff.

Sent 2 days ago.., in an email to me...
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
So much to do, so few hours in a day... The story of our lives.
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
If I may boldly suggest, - skip the game stuff and focus on the core of business functionality - IMHO.

You can get to that later... Even thou I don't at present, know what that means in market share and potential...
It is easy to get distracted with all of the cool (fun) stuff that can be implemented, at the detriment of the core that many depend upon.

I do this all the time and have to often ring myself into reality.


Myself, I try and focus on one item - and make it work (unless distracted). The topic of this thread.... When it won't - I reach out for help.

You have a great thing going here. We all want to see it succeed, one logical, progressive and intuitive step at a time.

My 2 pesos... Not to be taken as any slight or negative. Just venting as you know I will...
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
I'm sorry you somehow think I'm neglecting the rest. If so, please tell me what. ABMXPlay is just as any other ABM component I'm writing. I was out of ideas on what could be the next component and I just came accross an old project ABXPlay and it seemed like a good idea to implement it in ABMaterial.

I'm aware you seem somewhat agitated because you've spend 2 days on a bug I'm responsible for and I apologize for that. I'm waiting on your test project to find the ABMCanvas bug, but I can't solve what I was not aware of, and this is the first I hear about this bug. Rest assured it will get my full attention, just like any other reported bug.
 
Last edited:
Upvote 0

Harris

Expert
Licensed User
Longtime User
I'm sorry you somehow think I'm neglecting the rest. If so, please tell me what. ABMXPlay is just as any other ABM component I'm writing. I was out of ideas on what could be the next component and I just came accross an old project ABXPlay and it seemed like a good idea to implement it in ABMaterial.

I'm aware you seem somewhat agitated because you've spend 2 days on a bug I'm responsible for and I apologize for that. I'm waiting on your test project to find the ABMCanvas bug, but I can't solve what I was not aware of, and this is the first I hear about this bug. Rest assured it will get my full attention, just like any other reported bug.

Sorry, AB, I wasn't blaming you. It is more than likely my inability to understand what I am doing. I often spend too much time on one issue rather than reaching out in the first place. I don't like to bother others with something I should be able to fix myself. Bad habit...

All of your components are great ones. Keep pumping them out. I shall restrain my negative venting from now on.

Thanks for the preview of 2.00 I shall try them out today.
 
Upvote 0
Top