-
Notifications
You must be signed in to change notification settings - Fork 564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Efficient Immutable Data Structures #264
Comments
I don't think it's possible use mori directly, because the operations don't respect the type assumptions, since all of them turn any data structure in a lazy sequence, which has different semantics, etc. Google Closure would be interesting, but depends on generating code for that particular compiler assumptions. And I guess it would require generating source maps for debugging. |
I think adding compiler support for this might complicate things, but it should be possible to wrap the data structures' APIs using the FFI, and to give them some sensible types. There is also a plan to port the |
Yeah, I'm less interested in specifically using mori than I am in using efficient immutable data structures. It's the type of thing that seems like an obvious eventual optimization for a language that focuses on purity, but thinking about it early could prevent breaking changes later on. Naturally it's helpful that mori is an open-source implementation of those data structures in JS, but really I mentioned how CLJS achieves this as a starting point for discussion. |
So, yes, I think it should become a priority at some point, because what we have now is obviously not ideal, but I think the main focus for the next milestone is going to be porting the compiler to PureScript. After that, I'm happy to revisit this. The code base is also quite a nice place to experiment with ideas in my opinion, so if anyone had some ideas and wanted to try them out, it should be possible. |
Note, we now have fairly efficient immutable balanced 2-3 trees for maps in |
We now have arrays, lists, lazy lists, catenable lists, maps, string maps, sequences, sets, Bindings for something like Mori could be implemented in a library, but would be best tracked elsewhere I think. I'll close this. |
Hi, just a thought/remark. I think it might be worth reconsidering the Google Closure Compiler. When it used in the |
@wires because PureScript gives the compiler more guarantees, investing on PS-specific transformations just pays off better there wrt inlining, tree-shaking/DCE, and stuff than using GCC — afaik the current PS compiler already does all of this. People suggested implementing a supercompiler (https://github.com/purescript/purescript/wiki/GSOC-2015-Projects#supercompiler-for-functional-core) for PureScript some time ago, which would give even better performance, as it can do partial evaluation during compilation and stuff. |
A supercompiler for PureScript will likely be one of Fantasyland's summer of code projects in 2017. |
Right, thanks! I was suspecting that maybe by now the compiler caught up with GCC. Still, when used in a PS project using JS-FFI, its would be good to have some form of tree-shaking across the entire PS+JS codebase. For instance, you have probably seen http://rollupjs.org/ (it uses ES2016 |
There's a lengthy discussion about that sort of thing here #2207 |
Fixes purescript#264. Also fixes the same issue for data constructors.
ClojureScript's approach to emitting JS with high-performance immutable data structures is:
It seems like a low-cost way to get much better performance for functional use cases than the default JS implementations of these data structures, which are designed for mutation.
Thoughts on using some of these ideas in PureScript?
The text was updated successfully, but these errors were encountered: