Live data from Hacker News

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

medium.com

21–30 of 58 posts

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

#21

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.

Even if you think a compiled language will be faster, it might still be interesting by roughly how much (5%, 10x or 100x?). This can help make the trade off decision.

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

#22

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.

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?

A common language across front and backend systems is a huge benefit. I find it extremely productive to have a backend in Typescript on NodeJS, and a frontend in ReactJS, talking over a GraphQL layer where I'm autogenerating Typescript types from the GraphQL typedefs. Means I can share many libraries and tooling across the front and back ends, but most importantly it means devs feel much more comfortable digging into code on the other side. If a front end dev has an issue with a backend API call, he can just pull down the code and instantly inspect it and submit a PR of necessary without feeling "out of his element".

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

#23
post #11

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…

Express.js active development seems to stop. The last commit on v5 branch was from October 2018. We are still waiting for http2 (2 years) or better support for promises (3 years). https://github.com/expressjs/express/tree/5.0 https://github.com/expressjs/express/pull/4196 https://github.com/expressjs/express/issues/2761 If someone is doing a new project in node I would recommend: https://github.com/fastify/fastify ht…

Better support for promises? Koa 2 since 4 years ago.

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

#24

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?

A common language across front and backend systems is a huge benefit. I find it extremely productive to have a backend in Typescript on NodeJS, and a frontend in ReactJS, talking over a GraphQL layer where I'm autogenerating Typescript types from the GraphQL typedefs. Means I can share many libraries and tooling across the front and back ends, but most importantly it means devs feel much more comfortable digging into…

How you generate the types from graphql. I noticed most of the generators create types with all optional keys. Do basically you need to check all the time...

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

#25

Can someone ELI5 the node code sample? > full = full == "true"; Umm.. Why? > if (!!limit Not not limit? Is this due to some corner case conversion for JS to make 100% sure this gets into a boolean..? I'm sure both samples have its reasoning, I'm just not aware. Any help please?

> full = full == "true";

That's basically a way to convert a stringified bool to a bool. Not the way I'd do it, and "assignee_name, summary, limit" are all declared as reassignable just to be able to reassign "full".

> if (!!limit

That's pretty common in js, not usually in if statements, but in other cases. No idea why that was done that way.

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

#26
post #11

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…

Express.js active development seems to stop. The last commit on v5 branch was from October 2018. We are still waiting for http2 (2 years) or better support for promises (3 years). https://github.com/expressjs/express/tree/5.0 https://github.com/expressjs/express/pull/4196 https://github.com/expressjs/express/issues/2761 If someone is doing a new project in node I would recommend: https://github.com/fastify/fastify ht…

I feel like Koa JS deserves a mention.

https://koajs.com/

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

#27
post #24

Earlier quoted context omitted.

A common language across front and backend systems is a huge benefit. I find it extremely productive to have a backend in Typescript on NodeJS, and a frontend in ReactJS, talking over a GraphQL layer where I'm autogenerating Typescript types from the GraphQL typedefs. Means I can share many libraries and tooling across the front and back ends, but most importantly it means devs feel much more comfortable digging into…

How you generate the types from graphql. I noticed most of the generators create types with all optional keys. Do basically you need to check all the time...

If they're creating types with optional keys it's probably because that's how you're defining your types in GraphQL. E.g. with

type Foo { bar: String }

bar would be optional in the Typescript type because it's specified as optional in the GraphQL type. You would need to do the following to make it required:

type Foo { bar: String! }

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

#28
post #11

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…

Express.js active development seems to stop. The last commit on v5 branch was from October 2018. We are still waiting for http2 (2 years) or better support for promises (3 years). https://github.com/expressjs/express/tree/5.0 https://github.com/expressjs/express/pull/4196 https://github.com/expressjs/express/issues/2761 If someone is doing a new project in node I would recommend: https://github.com/fastify/fastify ht…

If it is a small project I'd recommend just using the built in http server. It is what all these projects use anyway, and if it's just a few routes it's usually easier to just use that instead of pulling in more dependencies.

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

#29

Can someone ELI5 the node code sample? > full = full == "true"; Umm.. Why? > if (!!limit Not not limit? Is this due to some corner case conversion for JS to make 100% sure this gets into a boolean..? I'm sure both samples have its reasoning, I'm just not aware. Any help please?

“!!” is a way to convert any “falsy” value to a Boolean false. E.g. if you have a flag “enableFoo” that can take the values of undefined, null, numerical zero, NaN, empty string, and actual Boolean false, all these values will be converted to false with “not not”. All other values, including - ironically - “false” as a string, will be converted to Boolean true.
Post reply on HN