#Wrap Rust code with Gleam?

1 messages · Page 1 of 1 (latest)

bright juniper
cedar surge
#

Using natively implemented code has massive drawbacks so you should avoid it as much as possible

#

But if you really have no other option available to you (for example, to use SQLite) then you can use Erlang NIFs or the native binding features of whatever JavaScript runtime you are using

bright juniper
#

I understand. I was mostly curious in case there's some Rust crate I want to wrap for performance reasons.

cedar surge
#

What's the crate?

#

Native FFI has a performance overhead and can easily negatively impact the scheduler, so often it's slower than well written BEAM code

plucky lake
#

Is there somewhere I could read about this? What are the drawbacks, why they occur, etc.

I also read here somewhere that some languages are not a good target for Gleam, I think it was Go that was discussed -- does it have anything to do with it?

hardy cedar
#

the warning box there for example

#

(and further docs on that page)

cedar surge
plucky lake
plucky lake
cedar surge
#

About what, sorry?

plucky lake
#

What makes a language a suitable target

cedar surge
#

That's a very large subject

plucky lake
#

I tried searching for the go discussion here on discord but go is a very generic word

cedar surge
#

Implementation of programming languages is a whole area of computer science

#

For Go and functional languages specifically their memory allocator and GC is a bad fit

#

They want a small number of large allocations

#

FP is about a large number of small allocations

plucky lake
#

Interesting, thanks. That's surely enough to send me down a rabbit hole

bright juniper
# cedar surge What's the crate?

Ok so, to give you a bit of context. I'm learning Gleam right now and I really like it. It also seems very well suited for data analysis and manipulation. It's functional, thus data is immutable and transforming data is very easy, but it is also statically typed. This got me thinking about a dataframe library in Gleam, which I believe doesn't exist (or at least, I have not found it). So I thought that it would be cool to wrap polars from Rust with Gleam, because it is very performant already and I got the feeling the Gleam isn't suited for highly performant operations (which is fine, it doesn't need to be) but maybe I'm just wrong

cedar surge