My mistake; unchecked operations work just fine if their arguments
(including constants) are given type hints. What happens if unchecked-
add/sub/... is given an argument of unknown type, though? It still
seems to work, though slowly.

On Dec 14, 12:35 pm, Michel Salim <michel.syl...@gmail.com> wrote:
> This follows from the recent micro-benchmarking discussion, though as
> it concerns a potential bug, I'm starting a new thread.
>
> With this (very inefficient) implementation of fib,
>
> (defn fib [n]
>   (if (<= n 1)
>     1
>     (+ (fib (dec n)) (fib (- n 2)))))
>
> computing (fib 40) takes, give or take, 12 seconds on a Core 2 (2
> GHz).
>
> Substituting unchecked-{add,dec,subtract} for +, dec and -, I've not
> been able to complete (fib 40). For (fib 20), the original takes 63 ms
> whereas the unchecked version takes 2215 ms.
>
> Que pasa?
>
> --
> Michel
--~--~---------~--~----~------------~-------~--~----~
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