@fpsfreak
What is slow? The whole program, or the model's animation (if there is any)
@Hangar18
The computer runs through the code and does any processing it has to, math, strings, memory, whatever... It also handles all the video stuff in between processing or vice versa. Generally, it will try and redraw the screen as often as it can. This may not be at good times for your program, because the resources are going to be allocated based on interrupts (loosly, the timing order that things happen like checking the serial port, or drawing a raster beam). This is where the sync command comes in handy. This gives you a certain amount of control as to how often you want the screen redrawn. When you set the sync rate, you are limiting the refresh to that specific cycle (as long as it's within the fastest possible refresh there can be based on your hardware and the program) and forcing the computer to halt the other interrupts until the refresh is done. This allows you to keep your screen redraws happening at a constant rate. If you set the sync rate to 0, there will be varying FPS on different machines. But if you set it to 40, and the processors aren't too too different then the game should run at the same speed on the other machines(40 fps in this case).
SYNC RATE isn't a maximizer, per say, it is a limiter to set an orderly control as to how often everything is redrawn. This helps to ensure that a game written on one machine will perform the same on another, and it gives you control over the speed in general.
When you place the SYNC command in the loop, your goal is to limit the refresh of the screen until everything before the SYNC command happens. If you had set the rate to 30, it may keep the refresh at 30 fps, but if you did intense math calculations or huge loops before it ever reached the SYNC, you may see a drop in FPS because the processing took so much time before it got to the video refresh. Now the opposite could be true as well. It may take no time at all to do the processing before the SYNC command but since you set it at a limit of 30, it will wait long enough so that the screen refreshes at 30 fps. If you never enter the SYNC command and have used SYNC ON, then the video will not refresh - DBC is waiting for you to indicate when to redraw with SYNC (and it will try to keep the FPS based on the SYNC RATE).
Back in the old days, one would interrupt the raster scan and squeeze in a pointer to code in the time between the redraws of the individual lines on the screen. This code would run and then disable the interupt when it was finished to redraw the next line. This allowed for the illusion of multitasking and a host of other cool effects that today are looked at as standard.
Enjoy your day.