Problem: result of process.memoryUsage() is hardly readable by humans, limiting it's usability for fast debugging.
Proposed solution: Add toString method to process.memoryUsage results.
Behaviour now: process.memoryUsage().toString() === "[object Object]"
Expected behavior:
/*
{ rss: 29233152,
heapTotal: 7159808,
heapUsed: 4383040,
external: 8224 } */
process.memoryUsage().toString(); // "rss: 27.9M; heapTotal: 6.8M; heapUsed: 4.2M; external: 8K"
I'm -1 on this kind of magical behavior. Besides, dividing the values by the appropriate amount to get the desired output is trivial enough in user land.
This would also be a breaking change for questionable upside. I'm also -1.
This would also be a breaking change
Is there any code that relies on String(process.memoryUsage()) === "[object Object]"?
Is there any code that relies on
String(process.memoryUsage()) === "[object Object]"?
Quite possibly.
Problem: result of
process.memoryUsage()is hardly readable by humans, limiting it's usability for fast debugging.
To be clear – do you see the issue in the JSON format, or in the fact that the output uses “raw” decimal notation like 352994328, which is indeed a bit harder to read than 353M?
In either case, I’d see us more inclined to add a custom util.inspect overload rather than overriding toString()…
A custom util.inspect overload is something I could :+1:
Given the feedback above, there's no way the original request will happen or make sense. I also really don't see the point of a custom util.inspect here.
Most helpful comment
A custom
util.inspectoverload is something I could :+1: