Closed Olical closed 3 years ago
Now thinking about it, I think that much code will just impact load time pretty horribly. Just like loading the whole Fennel compiler (which I've only just managed to prevent from loading if we don't need it).
Have you tested it out?
$ du -sh aniseed/lua luafun/fun.lua
288K aniseed/lua
32K luafun/fun.lua
I think boost the base functions by wasting 10% load time is not that horrible.
I have not, no! Although it does seem cool. Although if I use it inside Aniseed it seems like one of those libraries that pollutes everything it touches, like using ImmutableJS. You have to go all in with it and teach your users that you have to use the special functions from the library to interact with some things. Something I'm not too keen on, so maybe it's just best to have users include it in their code if they need it? So it's truly optional?
I would only include it in Ansieed if I actually depended on it so users can share that tool if they need it too. But I wouldn't just vendor it in just so others can use it if Aniseed doesn't need it.
Things to consider, because I'm still sort of open to this:
aniseed.core
code has it's internals replaced with luafun calls (if possible) is it faster to load and use Conjure, or is it the same?aniseed.core
with transparent references to luafun functions? If only one or two of them can like map and filter, maybe it's not worth it.I'll take a look if I have time.
I've added luafun to Aniseed and swapped map, filter and reduce over to use it. No idea if this breaks everything or makes any difference whatsoever, but it's there on the develop
branch of Aniseed.
Okay I was wrong, I've added luafun to Aniseed develop branch but I haven't integrated into aniseed.core
because the functions work very differently and return iterators, not more tables. So it is not a 1-1 conversion right now, I might be able to use these instead of my own map function etc but it won't get you the same optimisations going all in on luafun would.
So maybe I'll use luafun for Aniseed core just to remove some duplicate code, but users will have to learn and use luafun themselves to get the full speed benefit of chaining the function calls with iterators.
It's like the difference between a clojure map
call and a transducer really. As far as I can tell.
So luafun looks very unmaintained but REALLY cool. I'd love to slowly replace
aniseed.core
with it, maybe shim to it for the time being while also providinganiseed.fun
as another optional module you can require...I think it'll be a GREAT building block to ship with Aniseed, I'd love to rely on it within Conjure too. My current implementations in
aniseed.core
are pretty inefficient, but I haven't had to worry, I've never hit any performance issues. Now I'm thinking this could help remove any issues before they even pop up.Exciting! I could also use a maintained fork for other things at work too, so it could help me in my day to day work.
Would probably want to convert it to Fennel too 🤔 but probably still a separate repo?