Live data from Hacker News

ExpressJS vs. Actix-Web: performance and running cost comparison

medium.com

41–50 of 58 posts

Re: ExpressJS vs. Actix-Web: performance and running cost comparison

#41

Earlier quoted context omitted.

I’m skeptical of this finding out at least it’s generalizability. I know (and like) Rust a fair bit better than JS, but I would be surprised if I could build a nontrivial web app in Rust faster than Node. And that’s without using TypeScript. YMMV, but I’d be curious to hear from others with experience with both languages.

I've used Rust for two years and still regularly get stumped. Recently, I wanted to maintain a map of routes to futures so that multiple in-flight requests could await the same future while it fetches from disk. The Javascript version took about one minute. Using Rust doesn't give you free performance wins, especially not when working with async code where lifetimes actually get hard. Any time you're carrying around…

My first attempts with anything in Rust are also challenging. Second attempts, though, are straightforward as long as I have an example to work from and haven't forgotten about it. It would take me a lot longer to build your router example in Node than it did you because I haven't worked with Node but once I know how, maybe it would take me a minute, too.

What did you finally come up with for your router impl in Rust?

Re: ExpressJS vs. Actix-Web: performance and running cost comparison

#42
post #38

They are running Node with only one worker and are instead tuning the DB connection pool in that one worker... So the whole benchmark is bogus.

Author addressed this on a Reddit comment thread: https://www.reddit.com/r/rust/comments/fbu5tt/expressjs_vs_a... . The results aren't significantly different; Rust is still very much more efficient than NodeJS especially when considering memory utilization (and the hosting costs associated with that memory footprint).

Re: ExpressJS vs. Actix-Web: performance and running cost comparison

#43
post #41

Earlier quoted context omitted.

I've used Rust for two years and still regularly get stumped. Recently, I wanted to maintain a map of routes to futures so that multiple in-flight requests could await the same future while it fetches from disk. The Javascript version took about one minute. Using Rust doesn't give you free performance wins, especially not when working with async code where lifetimes actually get hard. Any time you're carrying around…

My first attempts with anything in Rust are also challenging. Second attempts, though, are straightforward as long as I have an example to work from and haven't forgotten about it. It would take me a lot longer to build your router example in Node than it did you because I haven't worked with Node but once I know how, maybe it would take me a minute, too. What did you finally come up with for your router impl in Rust…

I'm fluent in both Rust and JS. IMHO first attempts are much faster in JS than in Rust. Rust is much easier to maintain in the long term, and for large scale codebases it excels once the groundwork has been laid.

Re: ExpressJS vs. Actix-Web: performance and running cost comparison

#47
post #5

I understand that using Actix really highlights the speed advantage of Rust... but I think it's irresponsible to encourage rewrites in Rust using a framework that's dead because the developer decided to quit instead of fix security issues[0]. The last thing we need is a bunch of new Rust devs rewriting their perfectly fine Node code using an insecure framework. Rust is really fast, especially compared to Node. This i…

It's the only web framework in Rust that has thus far reached maintenance mode because it became feature complete, was heavily vetted by many teams, and is architecturally mature. It's not just really fast but has all of the bells and whistles. Further, people are actively contributing to the project. Replacing remaining sound yet unsafe blocks with fully safe rust, without taxing performance, is the remaining, ongoi…

reached maintenance mode because it became feature complete Actix web feature complete? Is that a joke or pure ignorance? Yes actix web is feature complete for building trivial web backends. Anything beyond that, actix will limit you.

Re: ExpressJS vs. Actix-Web: performance and running cost comparison

#48
post #30

No one has ever been deciding between express and actix-web

I have, because I did a bunch of Express+TypeScript, always wanted to learn Rust and wanted to bootstrap a business by optimizing costs.

I liked this article since I always wanted to see concrete numbers or at least a general idea.

It's not uncommon for business to move from Ruby/Python/JavaScript to Go as they grow. I personally preferred learning Rust over Go because of its depth.

Re: ExpressJS vs. Actix-Web: performance and running cost comparison

#49

Earlier quoted context omitted.

I can only think of ecosystem size and language familiarity. Authors addressed development speed and found that Rust's static typing and compiler checks reduced development time vs JS. What other reasons did you have in mind?

Development speed is one. If the author were more familiar with JavaScript (e.g. knowing what const does) it might have gone faster. Using TypeScript should erase the development time delta due to static types. If you're creating a frontend web app to go along with it there are others, such as reduced context–switching and using fewer tools. Frankly, a sample size of one is incredibly weak evidence that it's faster t…

Indeed I am working primarily on Rust now, though I used to write Node 2 years ago and this is one of pitfalls where I would like to rely on compiler. It was just one issue which could been easily detected. Some debugging time was spent aligning SQL query parameters and mapping selected fields to the output type - the problem is that when there is some misalignment node does not raise exception, rather just passing undefined value. That's what takes time, to realize that there is a problem and then find the issue. Agreed that in general expert in node probably won't hit such issues, though how many experts do we have. Type safety checks, including runtime checks, are actually making technology more adoptable. It does not seem that typescript can do that well though.

Re: ExpressJS vs. Actix-Web: performance and running cost comparison

#50

Is there any surprise here? Anecdotally Node seems fast for interpreters, but of course a compiled systems language like Rust blows it away. That’s a known trade off you make when picking a technology like Node; there are plenty of other reasons to use it.

Well it’s rust and actix so ya no big surprise. But take a look at es4x. It actually blows away Nodejs and many other compiled languages/web frameworks. And it’s in JS! They are in the most recent benchmark of TechEmpower.
Post reply on HN