Hacker News new | ask | show | jobs
by wyatwerp 2588 days ago
Is the speed bump for other-language libraries or for other-language applications?

For speeding up other-language libraries, D has a -betterC mode, which prevents you from using the subset of the language and the libraries (standard & user-defined) that relies on GC. The remaining language is a very clean C that simply works on the other language's GC'd memory (using the other language's C interface), and can use stack allocation or any heap allocation strategy of your choice for its working set (reference counting ala C++ shared_ptr could be the obvious choice, but it is your party).

For other language applications, it is a valid option to speed up the entire application by writing it in D, as it has "all" the features of those other languages + all the convenience that is afforded by a GC + threads if you don't want a multi-process design. I quote "all" because I mean useful things like blocks/closures, generic data structures, etc. - of course, neither Rust nor D give you runtime devices like monkey-patching/meta-class hackery/prototype changes.

1 comments

We've been rewriting a big Scala code base to Rust now since January and the team is advancing in a nice pace.

Our plan was:

- Take one part of the system to rewrite over JNA

- Run a massive amount of Scala tests against the new code

- When green, take another part

- Meanwhile the other part of the team writes the user-facing code base, connecting it to the new Rust crates

- The test suit works also over an integration layer, so the other team can test their code and the backend with the same test suite

We're quite far already. Originally I was the only person with Rust experience. Now there's five of us.

Why are you migrating from Scala?
The company wants much lower resource usage per node and easy integration with other languages.