| ▲ | Removed Rust to Gain Speed(prisma.io) |
| 50 points by 2233 5 days ago | 16 comments |
| |
|
| ▲ | ameliaquining 2 hours ago | parent | next [-] |
| An important part of the story here, not mentioned in this post but noted elsewhere (https://www.prisma.io/blog/from-rust-to-typescript-a-new-cha...), is that they gave up on offering client libraries for languages other than JavaScript/TypeScript. Doing this while mostly sharing a single implementation among all languages was much of the original reason to use Rust, because Rust is a good "lowest common denominator" language for FFI and TypeScript is not; it wasn't entirely about performance. If they hadn't tried to do this, they would likely never have used Rust; if they hadn't given up on it, they would likely still be using Rust. |
|
| ▲ | hresvelgr 2 hours ago | parent | prev | next [-] |
| I'm sure you could get even greater speed by removing Prisma. All you need is a migration tool and a database connection. Most recent example in my work where we removed an ORM resulted in all of our engineers, particularly juniors becoming Postgres wizards. |
|
| ▲ | baranul 4 days ago | parent | prev | next [-] |
| This is a decent example of not buying, getting pulled, or being forced into any corporate pushed hype or eliminating one's options. They re-evaluated and looked at what programming language was best for their situation, which was removing the Rust language and using something else. It then turned out, they actually got gains in greater user contributions, simplicity, efficiency, and even speed. |
| |
| ▲ | nine_k 3 hours ago | parent | next [-] | | > what programming language was best for their situation, which was removing the Rust language and using something else This is correct, but I'd say that the key was removing Rust and not using something else. Fewer moving parts, fewer JS runtime boundaries to cross, no need to make certain that the GC won't interfere, etc. Also, basically any rewrite is a chance to drop entrenched decisions that proved to be not as great. Rewriting a large enough part of Prisma likely allowed to address quite a few pieces of tech debt which were not comfortable to address in small incremental changes. Consider "Prisma requires ~98% fewer types to evaluate a schema. Prisma requires ~45% fewer types for query evaluation.": this mush have required quite a bit of rework of the whole thing. Removing Rust in the process was likely almost a footnote. | |
| ▲ | thunky 3 hours ago | parent | prev [-] | | > This is a decent example of not buying, getting pulled, or being forced into any corporate pushed hype It seems that maybe they did get hyped into Rust, because it's not clear why they believed Rust would make their JavaScript tool easier to develop, simpler, or more efficient in the first place. | | |
|
|
| ▲ | ckwalsh 2 hours ago | parent | prev | next [-] |
| I'm in the "Pro-Rust" camp (not fanboy level "everything must be rewritten in rust", but "the world would be a better place if more stuff used Rust"), and I love this post. They saw some benefits to Rust, tried it, and continued to measure. They identified the Typescript/Rust language boundary was slow, and noticed an effect on their contributions. After further research, they realized there was a faster way that didn't need the Rust dependency. Good stuff, good explanation! |
|
| ▲ | quotemstr 2 hours ago | parent | prev | next [-] |
| Good. Rust is fine, but it makes you pay a complexity tax for manual memory management that you just don't need most of the time. In almost all real world cases, a GC is fine. TypeScript is a memory-safe language, just like Rust, and I can't imagine a database ORM of all things needing manual memory management to get good performance. (Talking to the database, not memory management, is the bottleneck!) |
| |
| ▲ | amluto 2 hours ago | parent | next [-] | | I don’t think the problems they were dealing with had much to do with any of those properties of Rust. Their issue seems to have been that they weren’t using native JavaScript/TypeScript and that their situation was improved by using native TypeScript. If they had been using something like Java or Go or Haskell, etc, they may well have had even more downsides. | |
| ▲ | theusus an hour ago | parent | prev [-] | | > manual memory management Rust has automatic memory management. > Complexity tax Could you be more specific? | | |
| ▲ | honeycrispy 24 minutes ago | parent | next [-] | | I'm a seasoned Rust dev, and the trait/type system can get pretty complex. You don't inherit like typical OOP, you build on generics with trait constraints, and that is a much more complex and unusual thing to model in the mind. Granted you get used to it. | |
| ▲ | quotemstr 18 minutes ago | parent | prev [-] | | > Rust has automatic memory management Sure, if you define "automatic memory management" in a bespoke way. > Could you be more specific? The lifetime system, one of the most complex and challenging parts of the Rust programming model, exists only so that Rust can combine manual memory management with memory safety. Relax the requirement to manage memory manually and you can safely delete lifetimes and end up with a much simpler language. Have you ever written a Java or Python program? |
|
|
|
| ▲ | cyberax 3 hours ago | parent | prev [-] |
| PSA: detached floating panels are pure cancer. Avoid them. I literally can't scroll through your website. |
| |
| ▲ | jibal 2 hours ago | parent [-] | | So tell them ... posting it here is useless; the article was written a couple of weeks ago and they may not even know that it made it to HN. |
|