Even with inlining the code is rather silly ;)

    [x] (if x false true)

so you'd get,

   (if (if test false true) then else)

Which relies a bit too much on the JVM's JIT for my taste :D

I've always wondered what the reason for the original implementation is.
Keep closer to the implementation of not, so that no incompatibilities arise
should not become a protocol one day?

Cheers Jan


> On 22 Jan 2015, at 01:32, Mikera <mike.r.anderson...@gmail.com> wrote:
> 
> Interesting -  there seems to be a very slight performance advantage to your 
> version on my machine (consistently about 25% faster for if-nots in a tight 
> loop).
> 
> I think the problem is actually with "not" - which isn't getting inlined 
> currently. If I patch not so that it is inlined, the difference disappears.
> 
> Worth a quick patch maybe?
> 
> On Thursday, 22 January 2015 03:51:37 UTC+8, Leon Grapenthin wrote:
> I am surprised to find the two branch implementation of if-not as follows:
> 
> 
> ([test then else]
>    `(if (not ~test) ~then ~else))
> 
> 
> What I expected was:
> 
> 
> ([test then else]
>    `(if ~test ~else ~then))
> 
> 
> -- 
> 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
> Note that posts from new members are moderated - please be patient with your 
> first post.
> 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 
> <http://groups.google.com/group/clojure?hl=en>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com 
> <mailto:clojure+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to