-
Hello, First, tanks for the project, very good to see a project with a performance goal in mind. So... Its possible to make Req and Res (from ws or/and http) a Node Stream? *quick reference: "https://www.freecodecamp.org/news/node-js-streams-everything-you-need-to-know-c9141306be93/" Current the core HTTP/TCP stack is already a stream object, and this a very userfull feature. Of couse we can do some kind of intermediary stream like you did on the video sample, but the full drain/cork/uncork/pipe/unpipe... cicle probably can be made on the c++ side (plugin/addon/host) improving performance and reducing the some type conversions. |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 5 replies
-
Hi, From v0.15 and forward the project is not concerned with or tied to any particular Node.js design. So this means it does not try to mimic any particular interface such as Node.js Streams or anything like that. It also does not try and mimic Express or anything similar. |
Beta Was this translation helpful? Give feedback.
-
Understood. Anyway, the Stream interface probably is very good for you C/C++ side too (IMHO). It's an interesting pattern.
And you already have some functions using the same logic (like getBufferedAmount / onAborted, onWritable etc) to make a good pipe. Then at the end of the day, it may not require many changes. My only concern is to reduce some of the hacking necessary to make a streaming (as in the example), avoiding things like "buffer.buffer.slice". Anyway, thank you very much for your attention. |
Beta Was this translation helpful? Give feedback.
-
What Node.js does with their streams has no significance to this project. If you see similarities - good - but that doesn't mean anything more than that there are similarities. The entire premise, the hypothesis of this project since day 1 has always been and will continue to be: "Node.js is doing things unreasonably inefficient."In other words - the differences between this project and Node.js is no act of random. |
Beta Was this translation helpful? Give feedback.
-
I just remember I have a lot of opinions on this subject. |
Beta Was this translation helpful? Give feedback.
-
A stream is the opposite of "unreasonably inefficient". It can obviate several trips through I would really appreciate this. Your'e not mimicking anything by using arguably one of the best features of C++. |
Beta Was this translation helpful? Give feedback.
-
Isn't it faster for c++ to work with an array of bytes anyway? We don't even need streams as in NodeJS streams. We just need UInt8Array. Are you sure it wouldn't make things faster? |
Beta Was this translation helpful? Give feedback.
-
Maybe if you have all the bytes up-front, but not if you have to do a bunch of copies and heap allocations to get that single contiguous buffer. |
Beta Was this translation helpful? Give feedback.
Hi,
From v0.15 and forward the project is not concerned with or tied to any particular Node.js design. So this means it does not try to mimic any particular interface such as Node.js Streams or anything like that.
It also does not try and mimic Express or anything similar.