Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Memblock causes massive slowdown

Author
Message
Bluespark
15
Years of Service
User Offline
Joined: 18th Mar 2011
Location:
Posted: 25th Aug 2011 09:24 Edited at: 25th Aug 2011 09:54
This is definitely a bug, and should be fixed. Rem and unrem the noted line to see a massive speed difference.


Interestingly enough, this code does not slowdown, whether the noted line is remmed or not.


EDIT:
Using do/loop or while/endwhile also results in massive slowdown. Repeat/until results in massive slowdown. For/next does not result in slowdown.
The compiler version used was 1.0761
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Aug 2011 11:55
Quote: "This is definitely a bug, and should be fixed"

Taking your code as-is, then yes I can see a difference, however if I put a SYNC ON at the top and a SYNC in the loop, I can see no real difference.

Basically, if you have code that doesn't take control of its syncing, then yes - it's going to run slow and various things will affect it, sometimes unexpectedly. So take control of your syncing!

BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 25th Aug 2011 13:15 Edited at: 25th Aug 2011 13:18
Quote: "Using do/loop or while/endwhile also results in massive slowdown. Repeat/until results in massive slowdown. For/next does not result in slowdown."


Correct, this is by design due to the Safety code in DBPro. You have 2 options:

1. Disable Safety code in the DBP configuration file.

2. Use a For/Next loop (FOR n = 1 to 99999999) instead of the other alternatives, and use EXIT to drop out when required.

To expand on IanM's response (and this is just a possible theory), as soon as you include a memblock, the Safety Code will be checking the memory associated with any memblocks in the program. Thus your uncontrolled Syncing is severely affected. You are also comparing a very simple example with the addition of a complex entity, so the comparison will be very significant.

Jeff Miller
21
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: New Jersey, USA
Posted: 25th Aug 2011 14:30
I believe that for/next loops execute faster because they do not invoke an internal check for an Escape keypress.
Bluespark
15
Years of Service
User Offline
Joined: 18th Mar 2011
Location:
Posted: 25th Aug 2011 20:29
Ah, I see.
When I make simple 2d test programs, I don't use sync on, and that was the source of my confusion.

Login to post a reply

Server time is: 2026-07-11 10:26:18
Your offset time is: 2026-07-11 10:26:18