Android Question Unexpectedly slow number crunching

Arf

Well-Known Member
Licensed User
Longtime User
I've got a sub in my comms service module that constructs packets for sending via Asynchstreams.
I calculate a checksum for the data portion like this:

B4X:
Log("preparing checksum")
    Do While cnt < sz-1
        oChk(0) = Bit.Xor(oChk(0),oData(cnt))
        cnt = cnt + 1
    Loop               
    Log("checksum done")

I'm finding in some cases that this portion of code can take up to 20 seconds to run with a packet size of 4000 bytes. Why so slow, and is there any way I can speed it up? thanks.
 

Arf

Well-Known Member
Licensed User
Longtime User
Sorry I should have said - no problem in release, slow in debug.

Is there any way I can speed it up in debug? It just caught me out as I'm normally debugging MCUs and forget that execution speed is different in debug on this platform.
 
Upvote 0
Top