Leveraging modern low-level: a Rust backend for PureScript

News #16:

A few adjustments are underway, but all tests for approximately 54 modules are now passing (purust-*). Next step: the official tests.

Very interesting project! Testing it out to speed up a mostly pure code project (~50K LOC PureScript) that I’m running on NodeJS. I was actually able to compile most of the project and even run some unit tests. Not enough to get a sense of the performance comparison but it feels like it’s close :slight_smile:

Cut some tickets to the repo with the findings. 2 I was able to work around. Another one not (the freeap one). Hopefully this is helpful!

3 Likes

Thank you George @gwwatkins :slight_smile: :heart:

I didn’t think this would work on projects right away. Exciting news! Maybe we’re closer to seeing the light at the end of the tunnel than I thought.

Thank you so much for your support and your issues; I’ll take a close look at them. Even though gopurs is my priority right now, purust is the project that seems most interesting to me for PureScript in the long run, so I’m taking all of this very seriously.

Edit: Fixed all issues. I’ll probably give you a complete feedback on github by the end of the day (right now on a train).

2 Likes

Thank you Kevin for the super fast fixes and replies!

Looks like the input was met positively :slightly_smiling_face: I can continue give a bits of feedback as I work on this on the side :handshake:

I could try the go back end as well, though I liked the idea of porting some of the tightest loops to Rust. Since one of the optimizations that worked for this project was some some manipulating the data layout using JavaScript arrays.

1 Like

Absolutely, yes: I’m very happy to see people giving it a try, and that will help me a lot. It’s quite a large project, and every piece of feedback will be a great help to me. I’ll eagerly welcome all your feedback. Feel free to run your tests. Whenever you feel like it, I won’t mind at all (quite the opposite).

I’m going to focus my immediate efforts on the Array Processing test for Rust (+ Array Indexing, recently added). I’ll let you know when it’s fully optimized and ready to go, so you can test it :slight_smile:

1 Like

I took advantage of a bout of unwanted insomnia to improve the performance of the Array Processing test, which is now 100x faster: 25 μs → 0.25 μs (vectorization, fusion…). I’m actually still working on improving it, to get even closer to imperative C. :crab:

But I think you can already start testing things on your side, since it’s now much better than JS. I hope my optimizations address your own bottlenecks. (If you notice anything running slowly on Arrays, please don’t hesitate to let me know so I can add some tests, for example.)

purust branch edge (2b15ad6)
purust-arrays branch master (23600e8)
purust-foldable-traversable branch master (00be4d3)
purescript-backend-optimizer(-purust) branch edge-purust (3fd2eea)

0.25 μs → 0.0366 µs. Now better than ā€œhand-writtenā€ imperative C, in the benchmark. :wink:

You can find more here: Perf improvements on Arrays (WIP) Ā· Issue #4 Ā· 0x000000000000000000001/purust Ā· GitHub

1 Like