Here's an experiment for you: Change the LINE statement to include the BF after the end of it.
Instead of: LINE (X,y)-(x2,y), color
Use: LINE (X,y)-(x2,y), color, BF
QB64's C-code has been heavily optimized for the box fill routine, and you'll find it's usually much faster to include the BF for straight lines, than it is to exclude it.
I predict you'll see a considerable improvement in run speeds.