My port to BaCon runs in less than a second when using GCC compiler optimizations.
'Voronoi spiral gem.sdlbas
'translated from SmallBASIC 2016-08-19 MGA/B+
'translated to BaCon, sticking to the original code as much as possible, 12 sept 2016 - PvE.
DEF FN rgb(r, g, b) = r<<16 | g<<8 | b
DEF FN dergb(c, v) = IIF(c = 0, (v>>16)&255, IIF(c = 1, (v>>8)&255, v&255))
INCLUDE canvas.bac
OPTION VARTYPE FLOATING
gem = 700
tt = TIMER
WINDOW("Voronoi Spiral Gem", gem, gem)
points = 36 * 13 :' 10 degrees needs 36 points for 1 circle
cy = gem/2
ga = 10
DECLARE x, y, kl TYPE int ARRAY points
DECLARE r, g, b TYPE int
Scale = 0.7
FOR n = 0 TO points
x[n] = cy + Scale * n * COS(RAD(n * ga))
y[n] = cy + Scale * n * SIN(RAD(n * ga))
IF x[n] < gem AND x[n] > 0 AND y[n] < gem AND y[n] > 0 THEN
g = 127 - ABS(cy - x[n]) * 127 / cy + 127 - ABS(cy - y[n]) * 127 / cy
ELSE
g = 0
END IF
IF x[n] < gem AND x[n] > 0 THEN : r = 255 - x[n] * 255 / gem : ELSE : r = 0 : END IF
IF y[n] < gem AND y[n] > 0 THEN : b = y[n] * 255 / gem : ELSE : b = 0 : END IF
kl[n] = rgb(r, g, b)
INK (r, g, b, 255)
CIRCLE(x[n], y[n], 2, 2, TRUE)
NEXT
FOR xx = 0 TO gem
FOR yy = 0 TO gem
d = gem * gem + 1
FOR i = 0 TO points
a = x[i] - xx : b = y[i] - yy
q = a * a + b * b
IF q < d THEN : d = q : kkl = i : ENDIF
NEXT
INK(dergb(0, kl[kkl]), dergb(1, kl[kkl]), dergb(2, kl[kkl]), 255)
PIXEL(xx, yy)
NEXT
NEXT
SYNC : ' Optional
PRINT "Time: ", TIMER-tt, " msecs."
WAITKEY