Hi,
I'm running into what seems to be a lot of v8 GC activity when piping a 1GB file to /dev/null. The performance varies considerably depending on whether or not I have an empty heap or one that I've filled to the tune of 500MB. This is happening within node, but everything I can find is pointing to some interaction between Node's IO and v8 garbage collection.
Looking at --trace_gc, both the "slow" and "fast" paths do ~80 mark-sweep collections, but, when the heap is small, these take ~1-2ms whereas in the slow case (bigger heap) they take ~200ms.
Example slow: [2417:0x55f66b6913b0] 6858 ms: Mark-sweep 5.5 (11.0) -> 4.3 (11.0) MB, 1.0 / 0.0 ms (+ 2.4 ms in 4 steps since start of marking, biggest step 1.0 ms, walltime since start of marking 3 ms) finalize incremental marking via task GC in old space requested
Example fast: [2417:0x55f66b6913b0] 35062 ms: Mark-sweep 770.9 (888.5) -> 769.6 (888.5) MB, 2.8 / 0.0 ms (+ 224.0 ms in 247 steps since start of marking, biggest step 3.3 ms, walltime since start of marking 227 ms) finalize incremental marking via task GC in old space requested
It's not surprising that mark-sweep takes longer on a bigger heap, but it's reclaiming very little space, and I'd have expected it to either grow the heap or use an incremental collector.
I'd appreciate any suggestions you may have! (The real use case here involves JSON.stringify() and uploading to S3 using the AWS SDK, but this is the whittled down mystery.)
Thanks,
-- Philip