--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
You can typehing ints for locals (let, loop), restrictions are just for function arguments.AFAIK the reason is combinatorial explosion at https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IFn.java#L91
Does somebody from the development team read this user group? Or maybe I have addressed my questions to a wrong place?
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
As others have already said: long & double only is a restriction for function args. Not for interop. Not for local computations. Not for args to definterface methods. The reason for this restriction is the combinatorial explosion.
>> If we can do away with the interface generation, then support for arbitrary primitive arguments should become relatively straightforward.
How would we even call a function without an interface? Remember everything is defined behind vars, so you simply can't assume that a function won't be re-defed without notice. This is the reason interfaces exist notice how the following works:
user=> (defn foo ^long [^long x] x)#'user/foouser=> (defn baz [x] (foo x))#'user/bazuser=> (baz 42)42user=> (defn foo ^double [^double x] x)#'user/foouser=> (baz 42)ClassCastException user$foo cannot be cast to clojure.lang.IFn$LL user/baz (NO_SOURCE_FILE:1)user=>
Do a prototype with definterface/genclass or something and then report your results. My suspicions are that you'll find doing this without interfaces, while maintaining Clojure's semantics, is impossible.
Either way, if Clojure's semantics prove to be a fundamental issue for performance, then I think it is better to start work to improve Clojure's semantics (perhaps targeting 2.0 if we think it's a really big breaking change). This would be better, IMHO, than forever accepting semantics that prevent idiomatic code from ever being truly fast. I'd rather see a bit of breakage and fix my code when upgrading to Clojure 2.0 than be stuck with poor performance forever.
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Timothy, thanks,for giving a thorough answer to my questions, I appreciate this! As far as I understood, you did some work for Clojure team, and you have the necessary knowledge to express a knowing opinion on what are the implications of the matter.
James, for some numbers on OpenGL penalties, please refer to message #6 in thread (my initial answer for Timothy). You can also google on it, I am sure, you will find more information, or, why not, simply call NVIDIA or ATI support lines, and ask them. A perfectly valid question for them to consult you on :) As for more Java-friendly answers, you might also be interested in asking on LWJGL or JOGL forums. Personally I work with OpenGL for quite a long time already. Even when we were on C/C++ we never used doubles. Then we went Java, and there too, doubles are nowhere. One of the cornerstone computational workhorses of LWJGL, for example, the class Vertex3f, has no double version. And that is for a reason, not because Java bindings are bad and we must go C-plus-plusing now. Probably, after 10 years we will have only doubles and longs on GPUs... do you believe in it? Why we need them there at all?
>> This would be better, IMHO, than forever accepting semantics that prevent idiomatic code from ever being truly fast.
You're going to have a hard time convincing people to give up some of the dynamism of Clojure just for the sake of more performance. Especially considering that many Clojure users are perfectly okay with boxed values, let alone need floats or other primitives.
But what you are describing creates a whole ton of new problems, problems I don't see a good solution for. What you are describing would require the recompilation of entire source trees when a inner function is modified. So now we're in the Scala/Java land of recompile after every edit. Perhaps there's a use-case for invoke dynamic here, but now you're talking about breaking backwards compatibility for everyone not using Java 7+.
I'll be the first to admit that I'd like to rewrite the Clojure compiler as a true multi-pass optimizing compiler. But that's a task I haven't undertaken for two reasons 1) it's a ton of work that would take months (if not years) to reach the level of performance currently offered by Clojure. 2) I really don't need it. Every time I need that level of performance I drop to Java, CUDA or some other high performance toolkit.
Personally I think it would be much better for someone to come up with a typed lisp that interops very cleanly with Clojure. That way you can build your inner kernels using a lisp-like language, and then glue it together with Clojure.
But let me close by saying, if you really want better primitives, I'd suggest writing up a proposal for how it would work, perhaps even with some example using macros and genclass. Until then we don't have anything to go off of, people say "I'd love to have feature X", well we all would, but all the suggestions thus far won't work, so how do you plan on fixing that?
How are you going to recompile at all, when the compiler doesn't store the source code of functions after it compiles them? This is why this proposal needs to have a working prototype, to prove that these ideas actually work, until then proposals don't do much at all. Personally I don't see how the ideas in this proposal would work from the repl, and the repl is where most people do their work.
On 13 September 2013 08:54, Mikera <mike.r.an...@gmail.com> wrote:Either way, if Clojure's semantics prove to be a fundamental issue for performance, then I think it is better to start work to improve Clojure's semantics (perhaps targeting 2.0 if we think it's a really big breaking change). This would be better, IMHO, than forever accepting semantics that prevent idiomatic code from ever being truly fast. I'd rather see a bit of breakage and fix my code when upgrading to Clojure 2.0 than be stuck with poor performance forever.Out of curiosity, what is the performance hit in these cases?
Floats obviously save memory, and I believe they're also between 15% to 40% more efficient for division, at least on Intel CPUs. Is there also a cost to be paid passing doubles to OpenGL? Do you know what that cost is?
Obviously this is just a microbenchmark, but it fits my general experience that floats are a reasonable bit faster than doubles, typically 20-100% (doubles are closer when it is pure number crunching since 64-bit CPUs are actually pretty good at doubles, floats have a bigger advantage when you are manipulating a lot of data points and hence memory bandwidth matters more)Code here for those interested:src/test/java/mikera/vectorz/performance/FloatVsDoubleBenchmark.java
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@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 a topic in the Google Groups "Clojure" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/H5P25eYKBj4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojure+u...@googlegroups.com.
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+u...@googlegroups.com.
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.