for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
import Counter from './Counter';
function safeGetKey(report, key) {
return report[key] || 0;
}
export default class ProcessMemoryCountrer extends Counter {
bench() {
return process.memoryUsage();
static prettify(data) {
// eslint-disable-next-line no-magic-numbers
return `${Math.round(data / 1024 / 1024 * 100) / 100}MB`;
diff(start, end) {
const res = {};
const keys = new Set([
...Object.keys(start),
...Object.keys(end)
]);
keys.forEach(key => {
res[key] = safeGetKey(end, key) - safeGetKey(start, key);
});
return res;