console.log causes uint32array slowdown...
Reported by
d3c...@gmail.com,
Apr 6 2018
|
|||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36 Steps to reproduce the problem: This gist is fast. https://gist.github.com/d3x0r/be849400be3ea30877568e5656a86ca3 how to slow down. (line 1) function pcg_setseq_128_srandom_r() { //const state = new Uint32Array([0,0,0,0,0,0,0,0]); const state = [0,0,0,0,0,0,0,0]; uncomment the first line to use uInt32array and comment the second const state line . (use typed array instead of array). (On my system it reports Done in 2045 /ms 48899.75550122249 1564792.1760391197) as is , with a standard array. If it runs more than 4 seconds I end it... because it will be 15-20 seconds . (Done in 22615 /ms 4421.843908910016 141499.0050851205) With the following mentioned speedups Uint32array IS faster.... The first thing, replace the state with Uint32array, if fast reports (Done in 1530 /ms 65359.47712418301 2091503.2679738563 ) ---------- Okay? Is that reproducable? How to speed up. 1) remove the console.log( testRng ); on line 46. (it's done before the loop, no the logging itself is not measured in the speed) or 2) comment out state: new Uint32Array([0,0,0,0,0,0,0,0]), on line 10. This is a Uint32Array that is put into the RNG object returned; and if console.log doesn't log a uint32array type it's fast. What is the expected behavior? The array I mention in the second case isn't even referenced, except when the console.log prints the object it's returned in. The other Uin32array is the one that gets used. What went wrong? excessive slowdown... I am using Node.JS actually; so actually it's fast in the browser with.... Though I don't understand why doing anything with a variable that's not used would cause a slowdown for anything else... Did this work before? N/A Chrome version: 65.0.3325.181 Channel: stable OS Version: 10.0 Flash Version: Attached file is configured to be slow; is not exactly the same as the gist; that is the first change of commented lines was done.
,
Apr 7 2018
node.js bug tracker: https://github.com/nodejs/node/issues BTW, only node.js 9 is affected, not 8.
,
Apr 7 2018
Yes; I started a bug there also https://github.com/nodejs/node/issues/19858
,
Apr 8 2018
,
Apr 8 2018
This doesn't appear in node 10 nightly build. Should probably just close it...
,
Apr 9 2018
|
|||
►
Sign in to add a comment |
|||
Comment 1 by woxxom@gmail.com
, Apr 7 2018