3 ms·
This is a huge deal for me. I am creating server[1] for Node.js: "npm install server". The slowest part I noticed in some initial benchmarks was the promise-bas
by franciscop 10y ago
This is a huge deal for me. I am creating server[1] for Node.js: "npm install server". The slowest part I noticed in some initial benchmarks was the promise-based code which is used heavily instead of express' callback based middleware.
While performance is not one of the main concerns for the library (they are simplicity, "batteries-on" and user experience in general) it is nice to see that my hunch was right; V8 would provide a 500% performance boost to Promises.
[1] http://serverjs.io/ http://serverjs.io/
- davnicwil 10y agoI've never seen this before and it looks interesting - from a brief scan of the source & about section it looks to me like a wrapper over express to provide sensible defaults to round off some of the sharp corners when setting up a project from scratch. This could be extremely useful. I've been using express in production for years, and though setting up a new server is not fundamentally difficult, it does involve a lot of common boilerplate (cookie-parser et al) that I think a lot of people already solve with a boilerplate template. This could be a cleaner, more fully-featured approach. Is this more or less it, or is there more to it / future aims to do more? I also wonder - did you talk to the express developers about making direct contributions to provide solutions to these problems from within the express library itself, rather than externally via a wrapper library? I'll keep an eye on the development of this project :-)
- franciscop 10y agoThanks! I got started few months back. I haven't really talked to them besides asking a question or two. The thing is, express used to be like this but it was then split up; from what I read it was mainly due to unstability in the subpackages, something which I think/hope will be solved by now. Another point is apparently it's easier to maintain since there have been some problems internally. The main differences (for the initial or a later release) are: * A lot of functionality out-of-the-box. Just install it and get to work. * Websockets as first-class citizens: since they are one of the major advantages of Node.js in itself it makes sense they are trivial to use. * Error handling: intercept some messages from Node.js and provide a more human-readable version. * Promise-based. There's also a single parameter for middleware instead of a [err], req, res, next parameters, since Promises work really well with a single parameter. You might think that this comes from http://koajs.com/ http://koajs.com/ , but only the name comes from there, I used to call it inst for instance until I found a better name, which I found in Koa's ctx. Oh, I talk about all of this in here: https://serverjs.io/about https://serverjs.io/about