like Paul said earlier changing the globals to macros makes seems to
make a huge impact.
and the check-bounds and draw-line get called for each line on the
screen so it makes sense
that optimizations there will make a big impact.

On Apr 2, 8:05 am, MikeM <michael.messini...@invista.com> wrote:
> Starting with your version, I got about a 2x improvement with the
> following:
>
> (defn check-bounds [x y]
>    (let [f2 (float 2.0)
>          f4 (float 4.0)]
>    (loop [px (float x)
>           py (float y)
>           zx (float 0.0)
>           zy (float 0.0)
>           zx2 (float 0.0)
>           zy2 (float 0.0)
>           value (float 0)]
>       (if (and (< value (*max-steps*)) (< (+ zx2 zy2) f4))
>            (let [new-zy (float (+ (* (* f2 zx) zy) py))
>                  new-zx (float (+ (- zx2 zy2) px))
>                  new-zx2 (float (* new-zx new-zx))
>                  new-zy2 (float (* new-zy new-zy))]
>                  (recur px py new-zx new-zy new-zx2 new-zy2 (inc
> value)))
>            (if (== value (*max-steps*)) 0 value)))))
>
> f2 and f4 didn't do much, most improvement seems to come from (* (* f2
> zx) zy) in place of (* f2 zx zy). Using the arity 2 multiply results
> in the multiply being inlined.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to