Skip to main content

Go or Rust

Which is better for data science?



Go and Rust are contemporary systems programming languages. As compiled, statically typed languages, they share many characteristics. Go protects us from memory allocation problems by being garbage-collected. Rust ensures memory-safety through its compilation process.

The mantra of Go is simplicity. The mantra of Rust is safety.

Go is a high-level systems programming language, most suitable for networking, microservices, backend middleware, distributed processing, and cloud computing. Go web servers are exceptionally fast and can be written using the Go standard library.

Rust is a low-level systems programming language, most suitable for operating systems, compilers, embedded software, firmware, and device drivers.

Database management systems involve both high- and low-level systems programming. So, we find databases build with Go such as CockroachDB. and Weaviate, as well as databases build with Rust such as SurrealDB and Qdrant.

These resources provide even-handed, informed comparisons of Go with Rust:

Rust vs. Go: Why They’re Better Together

Golang vs. Rust: Which is Better?

Consider these factors when comparing Go with Rust:

  • Market/job opportunities (Go much better than Rust)

  • Productivity, ease of learning, speed of programming (Go better than Rust) Compared with Rust, Go is easier to learn, easier to read and write, and easier to maintain over time. Concurrent processing is easier to implement in Go than Rust.

  • Collaboration, community, teamwork, onboarding new developers, shared software engineering methods (Go better than Rust) Go is especially good for start-ups.

  • Ecosystem (both Go and Rust are strong) Go has an advantage in having a more complete standard library, whereas Rust programs must often rely on third-party libraries. Both Go and Rust have excellent and extensive documentation and training materials.

  • Safety (regarding memory overruns, Rust safer than Go) With Go, we ensure safety by using programming best practices and testing utilities, including options to the build command.

  • Performance (Rust can be better than Go in run-time execution speed) Go garbage collection imposes a performance penalty, which can be a problem with applications requiring microsecond real-time responsiveness. There may be a need examine Go garbage collection, setting parameters, opting for manual execution, or turning the system off completely. Go software developers examine benchmarks and software profiles to identify performance bottlenecks and issues.

Motivated by performance and a desire to support maintainable code bases over time, many organizations have converted backend systems from Python, Ruby, JavaScript/Node.js, C#, and Java to Go. Google has moved many systems from C++ and Java to Go.

Organizations also consider moving from older programming languages to Rust. And, motivated by a need for uniformly fast execution (without delays imposed by garbage collection), a few organizations have converted from Go to Rust, including Discord and SurrealDB.

Data scientists and data engineers do high-level systems programming more often than low-level systems programming. They develop analytics applications, manage data pipelines, and implement backend systems, including web servers, app servers, and database servers. Data scientists and data engineers are users of database systems, not developers of database systems.

Moving from Python or R to Go is easier than moving to Rust.

Bottom line: Go has more to offer data scientists than Rust.

See Building Systems and Services to learn more about Go systems programming.

See Developing Applications for examples of applications written in Go.

Resources for Learning Rust #

Free Rust training is available from Green Tea Coding. Most reasons given for learning Rust in the introductory video Learn Rust to FUTURE PROOF Your Developer Career apply to Go as well as Rust.

Klabnik, Steve, and Carol Nichols. 2023. The Rust Programming Language (second edition). San Francisco: No Starch Press. [ISBN-13: 978-1-7185-0310-6] The source code and electronic book are available from the book’s GitHub repository.

Back to the Languages for Data Science page.