My 2¢ on the subject, Ferret is not dead, I've been working on it for sometime now. Latest builds/docs are available at [1].
> Can the Immutable Persistent Data Structures be implemented with a reference-counting scheme rather than a garbage collector? This may improve performance. That is what Ferret uses. But reference-counting is not cheap. This snippet, (reduce + 0 (range 10000)) will spend most of its time inc/dec reference counts (When running in single threaded mode with a memory pool.). > In a similar vein, can the allocation strategy be controlled for these structures in such a way as to optimize cache locality? Currently when running on embedded systems or in single threaded mode ferret can be configured to run using a memory pool. This avoids calling malloc/heap at runtime, improves performance and determinism you can also tell how much memory will be used at compile time. In single threaded mode this also improves cache locality. (A linked list is just a sequential memory blocks from the pool allocated on the stack.) > It wouldn't have to depend on an existing runtime environment like JVM or JavaScript. Ferret uses its own runtime. No third party dependencies. Generated code is strict ISO C++11. > Could certain anonymous functions be optimized or inlined in a way that improves performance over JVM/JS implementations? Ferret does simple escape analysis when you are not passing a fn as variable, it is created on the stack. A ferret function is a C++ functor and no runtime lookup is necessary, compiler should be able to inline them depending on the optimization level. > Is there a way to compile C++ code at runtime? This would be essential for the REPL and for Macros. This is not necessary for macros. Ferret is intended for embedded systems a REPL is not really useful when you have to jump through hoops to communicate with the device. Ferret does supports macros. Everything is compiled there is no reader or eval, you can't add/remove/resolve symbols during runtime. (Unless you setup your own system for it.) > The main motivation would be performance gains. Speed is not my main motivation. Ferret is not lighting quick but allows you to easily interact with C,C++ libraries or drop in arbitrary C++ code to squeeze that last bit of performance for critical sections of code. i.e As someone already said in the thread with ferret you can take the julia route. > Julia relies on external native libraries for performance (BLAS, GPU, whatever). The speed of those libraries is not due to the language (usually C or ASM) but to the fact that they use algorithms that are heavily optimized for each hardware architecture [1] http://dropbox.nakkaya.com/builds/ferret-manual.html Best, On Mon, Apr 25, 2016 at 10:47 PM, JvJ <kfjwhee...@gmail.com> wrote: > I've been wondering lately about getting Clojure to compile to native > code, and so I've been doing some looking around. > > There are a few projects that are on the right track, such as TinyClojure > <https://github.com/WillDetlor/TinyClojure> and Ferret > <http://nakkaya.com/2011/06/29/ferret-an-experimental-clojure-compiler/>, > but they are incomplete and don't seem to be under active development any > more. > > I'm wondering about the requirements, how much work it would take, and > whether or not it would be worth it. My current thinking is of a > Clojure->C/C++ compiler. > > So far, I have a few topics for discussion that I'm unclear about that > might be necessary for this kind of project: > > - Can the Immutable Persistent Data Structures be implemented with a > reference-counting scheme rather than a garbage collector? This may > improve performance. > - In a similar vein, can the allocation strategy be controlled for > these structures in such a way as to optimize cache locality? > - Can we take advantage of tail-call optimization in existing C++ > compilers? > - It wouldn't have to depend on an existing runtime environment like > JVM or JavaScript. > - Could this reduce reliance on reflection and increase performance? > - Could a new, clojure-optimized runtime be created that improves > performance? > - Could certain anonymous functions be optimized or inlined in a way > that improves performance over JVM/JS implementations? > - Is there a way to compile C++ code at runtime? This would be > essential for the REPL and for Macros. > > > Let me know if anyone has any thoughts on the matter. > > Thanks > -- Nurullah Akkaya http://nakkaya.com -- 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.