MCPcopy Create free account
hub / github.com/tensorflow/tfjs / showDiff

Function showDiff

scripts/bundle-size-util.js:26–41  ·  view source on GitHub ↗
(newSize, masterSize)

Source from the content-addressed store, hash-verified

24}
25
26function showDiff(newSize, masterSize) {
27 const diffBytes = newSize - masterSize;
28 const diffPercent = (100 * diffBytes / masterSize).toFixed(2);
29 const sign = diffBytes > 0 ? '+' : '';
30
31 const charWidth = 7;
32 const diffKiloBytes =
33 (sign + (diffBytes / 1024).toFixed(2)).padStart(charWidth, ' ');
34 const masterKiloBytes =
35 ((masterSize / 1024).toFixed(2)).padStart(charWidth, ' ');
36 const newKiloBytes = ((newSize / 1024).toFixed(2)).padStart(charWidth, ' ');
37
38 console.log(` diff: ${diffKiloBytes} K (${sign}${diffPercent}%)`);
39 console.log(` master: ${masterKiloBytes} K`);
40 console.log(` change: ${newKiloBytes} K`);
41}
42
43exports.getFileSizeBytes = getFileSizeBytes;
44exports.showDiff = showDiff;

Callers 1

Calls 1

logMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…