Rust for "data first" problems?

My thesis involves a "smart algorithm, small data" class problem. When I ported my project into Rust from R, the performance gain was around 500-700%. Given that I study small mountain streams, with no formal computer science education, I felt a swell of pride that I was able to accomplish this in Rust.

Now I am applying for teaching positions at universities, including one position as an instructor for data analysis in the environmental science program. Their curriculum is entirely in R, based on Wickham's tidyverse, with which I am quite familiar. Personally, after programming in Rust I do not particularly want to go back to R, but professionally I could not recommend changing the class to focus on Rust as a tool. As @sebasv notes, Python-Numpy is a more apt contender because of advantages in usability and user-friendliness.

Many of the basic workflow tasks (especially during data exploration) that are streamlined in R and Numpy require extra steps in Rust. Users on this forum have pointed out that Rust makes fallible operations explicit, so an "automatic" operation like loading a csv into a dataframe in R might require extra time on my end setting up some structs in serde and then checking to make sure the read didn't fail. There are many examples of Rust entailing "extra steps", if not a whole script, to replace a single line of code.

The ecosystem of user-defined packages for R and Numpy exacerbates this trend, abstracting away implementation details for the convenience of the user. Learning Rust has taught me to value knowing when and where my program is doing something fallible, especially during debugging. But when someone else has done the debugging, and I am using their feature-rich package, the idea of reinventing the wheel in Rust has limited appeal.

Using R or Numpy is like driving around in a sports car. You just turn the wheel, press the pedals, and burn rubber. Rust (and other systems languages) are like getting a spaceship. You can go places and do things that you never dreamt of in a car. They are harder to pilot, but the possibilities seem unlimited! With the Rust ecosystem still in development, it feels like parts of your spaceship come in boxes of parts labeled "some assembly required".

6 Likes