NeTT
NeTT3y ago

ML with FFI

Suppose you wish to do some machine learning stuff with Deno, would it be optimal to use FFI with C over Rust?
8 Replies
NeTT
NeTTOP3y ago
That may be a strange thing to ask but I was just curious as someone who knows less C than Rust. Haven't tried FFI with C so wanted to know if it was worth it.
dj
dj3y ago
yep, definitely there's https://github.com/denosaurs/netsaur which has a C backend although much WIP atm but for simple models its performance is on par with tensorflow and even better
NeTT
NeTTOP3y ago
Guess I gotta learn some C then
dj
dj3y ago
don't really need to, Rust can be used as well
NeTT
NeTTOP3y ago
I specifically had that doubt because Netsaur seemed cool and my rust FFI was like 1.7x slower than JS code itself Tho it's mostly just me and my bad code
dj
dj3y ago
yea language shouldn't matter here, there must be something with the code
NeTT
NeTTOP3y ago
Certainly I guess I'll go try to improve my rust code then Thanks btw
dj
dj3y ago
np, and btw make sure your ffi calls go through fast api otherwise they'll be just slow