Uh oh!
There was an error while loading. Please reload this page.
src: remove BINARY encoding - #5504
Conversation
It was fun, now it is gone.
indutny
commented
Mar 1, 2016
indutny
commented
Mar 1, 2016
cc @nodejs/ctc @nodejs/collaborators @nodejs/crypto |
Fishrock123
commented
Mar 1, 2016
Could you explain what benefit this is to us? I don't really understand. |
indutny
commented
Mar 1, 2016
Of course, As it is right now, it does not provide much use IMO, and there are lots of code to handle it. Therefore I propose removing it. |
mscdex
commented
Mar 1, 2016
-100. The |
indutny
commented
Mar 1, 2016
@mscdex example? |
indutny
commented
Mar 1, 2016
What if I will change defaults for |
mscdex
commented
Mar 1, 2016
@indutny Regexps was one such example. Anything from |
indutny
commented
Mar 1, 2016
@mscdex why |
mscdex
commented
Mar 1, 2016
@indutny I think the reason that the default encoding is
I'm not sure what you mean here. Converting binary to utf8 is not safe. |
seishun
commented
Mar 1, 2016
+1 it was meant to be removed long ago. @mscdex why would you use regexp for non-textual data? |
indutny
commented
Mar 1, 2016
@mscdex it is not safe to pass @mscdex I would really appreciate if you could share a link with me, demonstrating a use case in some project. From what I heard, it does not look like |
mscdex
commented
Mar 1, 2016
@seishun Because it's useful if you need something more than a simple |
seishun
commented
Mar 1, 2016
mscdex
commented
Mar 1, 2016
@indutny My point is that if you change the default encoding to utf8, strings containing binary bytes can get misinterpreted: |
indutny
commented
Mar 1, 2016
Well, same thing with >newBuffer('привет','binary').toString()'?@825B' |
mscdex
commented
Mar 1, 2016
@indutny I don't see that as the same thing. Once you have imported the binary string with the 'binary' encoding there is no need to do |
indutny
commented
Mar 1, 2016
@mscdex what is "import the string safely" in your definition? |
micnic
commented
Mar 1, 2016
Is there any performance impact when using |
mscdex
commented
Mar 1, 2016
@indutny "safely" meaning the data/content is not modified |
Debug mode slows execution speed. There is work afoot to enable Debug mode runs on the continuous integration infrastructure for the project. Some tests are timing out, such as test-net-nodejsGH-5504.js. This change doubles the timeout returned from `common.platformTimeout()` when running in Debug mode. It also removes an unused variable from the aforementioned test-net-nodejsGH-5504.js. PR-URL: nodejs#4431 Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Examples when Binary is useful: varobj={};functionwasExecuted(buf){returnbuf.toString('binary')inobj;//Here we could use hex but it works slower and requires more memory}functionaddNumberToString(s,num){varisBuf=Buffer.isBuffer(s)&&(s=s.toString('binary'),true);//Here we can work with s like usual string. We don't need write individual//code for Buffer case. Of course we shouldn't add to string big char codes.s=s+num;returnisBuf ? newBuffer(s,'binary') : s;}I guess I can not use utf8 in these examples because not all bytes sequences can be safely converted to utf8, am I right? |
trevnorris
commented
Apr 25, 2016
@vitaliylag The majority of utf8 byte sequences can't be converted. A useful usage I've used in the past is when I want to hold many open file contents that are relatively large in size (>= 1MB). Done this while parsing data sets. If the file text can be assumed as ascii or latin1 then the string can be referenced out side of the heap. Example script: constbuf=Buffer.alloc(1024*1024,'a');constarr=[];for(vari=0;i<1e3;i++){arr.push(buf.toString('binary'));//arr.push(buf.toString('utf8'));}process._rawDebug(require('v8').getHeapStatistics().used_heap_size/0x100000);Using |
Avoid transient DNS issues in test sequential/test-net-GH-5504 by using the IP address instead of the 'localhost' host name. Fixes: nodejs#6611 PR-URL: nodejs#7524 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Avoid transient DNS issues in test sequential/test-net-GH-5504 by using the IP address instead of the 'localhost' host name. Fixes: #6611 PR-URL: #7524 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Avoid transient DNS issues in test sequential/test-net-GH-5504 by using the IP address instead of the 'localhost' host name. Fixes: #6611 PR-URL: #7524 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Avoid transient DNS issues in test sequential/test-net-GH-5504 by using the IP address instead of the 'localhost' host name. Fixes: #6611 PR-URL: #7524 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Avoid transient DNS issues in test sequential/test-net-GH-5504 by using the IP address instead of the 'localhost' host name. Fixes: #6611 PR-URL: #7524 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Avoid transient DNS issues in test sequential/test-net-GH-5504 by using the IP address instead of the 'localhost' host name. Fixes: #6611 PR-URL: #7524 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Avoid transient DNS issues in test sequential/test-net-GH-5504 by using the IP address instead of the 'localhost' host name. Fixes: #6611 PR-URL: #7524 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
test-net-nodejsGH-5504 failed on smartos14-64 in CI. The internal test timeout expired. It is currently 2 seconds. That appears to be somewhat arbitrary. It may be possible to rewrite the test without the timer. As an immediate workaround, increase the timeout to 5 seconds.
The test is failing on `SmartOS` quite often. Removing the timeout seems to fix it. Fixes: nodejs#8930 PR-URL: nodejs#9461 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
* Improve comments describing test. * Remove unnecessary `common.noop` * Remove confusing scoping of `c` identifier
* Improve comments describing test. * Remove unnecessary `common.noop` * Remove confusing scoping of `c` identifier PR-URL: nodejs#13025 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Pull Request check-list
Please make sure to review and check all of these items:
make -j8 test(UNIX) orvcbuild test nosign(Windows) pass withthis change (including linting)?
test (or a benchmark) included?
existing APIs, or introduces new ones)?
NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.
Affected core subsystem(s)
Please provide affected core subsystem(s) (like buffer, cluster, crypto, etc)
Description of change
It was fun,
now it is gone.
I decided to follow @chrisdickinson footsteps and submit provocative PR 😉 Hopefully this will help to spin of a useful discussion!