3 ms·
Because everything is a fexpr, with lambda built on top of it, when you call a function you're not passing it values, you're passing it code and a first class e
by reitzensteinm 6y ago
Because everything is a fexpr, with lambda built on top of it, when you call a function you're not passing it values, you're passing it code and a first class environment to use to execute it.
Further, because macro like features are first class, they're executed each time they're used as opposed to generating code.
I believe there are decent implementations but I bet they put a fair amount of work in to making them fast. The naive reference implementation is extremely slow.
While my toy project is a bit different and probably even more wasteful (with a list calling convention and immutability), it faces similar challenges. Take a read through core.clj and try to spot where the 88 million function calls are spent.
- mst 6y agoYah, my kernel-like thing ... oh gods the number of reductions. lambda (wrap) basically has to be VM provided code, and that's just the start. But for sheer flexibility it's beautiful and I don't feel like giving up yet :)
- sparkie 6y agoklisp is quite efficient (though still slow compared to other Lisps). Bronze-age-lisp optimizes some of the most critical parts in assembly language. This is probably the fastest Kernel you will find. Some details on the design were published in 4 posts to this group: https://groups.google.com/g/klisp https://groups.google.com/g/klisp