MCPcopy Create free account
hub / github.com/firebase/firebase-tools / renderOperationSpeed

Method renderOperationSpeed

src/profileReport.ts:446–486  ·  view source on GitHub ↗
(pureData: any, hasSecurity = false)

Source from the content-addressed store, hash-verified

444 }
445
446 renderOperationSpeed(pureData: any, hasSecurity = false) {
447 const head = ["Path", "Count", "Average Execution Speed", "Average Pending Time"];
448 if (hasSecurity) {
449 head.push("Permission Denied");
450 }
451 const table = new Table({
452 head: head,
453 style: {
454 head: this.options.isFile ? [] : ["yellow"],
455 border: this.options.isFile ? [] : ["grey"],
456 },
457 });
458 const data = this.collapsePaths(pureData, (s1: any, s2: any) => {
459 return {
460 times: s1.times + s2.times,
461 millis: s1.millis + s2.millis,
462 pendingCount: s1.pendingCount + s2.pendingCount,
463 pendingTime: s1.pendingTime + s2.pendingTime,
464 rejected: s1.rejected + s2.rejected,
465 };
466 });
467 const paths = Object.keys(data).sort((a, b) => {
468 const speedA = data[a].millis / data[a].times;
469 const speedB = data[b].millis / data[b].times;
470 return speedB - speedA;
471 });
472 for (const path of paths) {
473 const speed = data[path];
474 const row = [
475 path,
476 speed.times,
477 formatNumber(speed.millis / speed.times) + " ms",
478 formatNumber(speed.pendingCount === 0 ? 0 : speed.pendingTime / speed.pendingCount) + " ms",
479 ];
480 if (hasSecurity) {
481 row.push(formatNumber(speed.rejected));
482 }
483 table.push(row);
484 }
485 return table;
486 }
487
488 renderReadSpeed() {
489 return this.renderOperationSpeed(this.state.readSpeed, true);

Callers 4

renderReadSpeedMethod · 0.95
renderWriteSpeedMethod · 0.95
renderBroadcastSpeedMethod · 0.95
renderUnlistenSpeedMethod · 0.95

Calls 2

collapsePathsMethod · 0.95
formatNumberFunction · 0.85

Tested by

no test coverage detected