mirror of
https://github.com/chenasraf/DefinitelyTyped-tools.git
synced 2026-05-18 01:49:03 +00:00
Format
This commit is contained in:
@@ -166,7 +166,7 @@ export const metrics: { [K in MetricName]: Metric } = {
|
||||
getValue: x => x.memoryUsage / 2 ** 20,
|
||||
getSignificance: compose(
|
||||
proportionalTo("identifierCount"),
|
||||
withThreshold(FineIf.LessThan, 65),
|
||||
withThreshold(FineIf.LessThan, 65)
|
||||
)(getOrderOfMagnitudeSignificance)
|
||||
},
|
||||
assignabilityCacheSize: {
|
||||
|
||||
@@ -11,10 +11,7 @@ export enum OverallChange {
|
||||
Mixed = Worse | Better
|
||||
}
|
||||
|
||||
export function getOverallChangeForSingleComparison(
|
||||
before: PackageBenchmarkSummary,
|
||||
after: PackageBenchmarkSummary
|
||||
) {
|
||||
export function getOverallChangeForSingleComparison(before: PackageBenchmarkSummary, after: PackageBenchmarkSummary) {
|
||||
let change = OverallChange.Same;
|
||||
for (const { significance } of getInterestingMetrics(before, after)) {
|
||||
switch (significance) {
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import * as os from "os";
|
||||
import * as path from "path";
|
||||
import {
|
||||
getParsedPackages,
|
||||
assertString,
|
||||
assertNumber,
|
||||
getSystemInfo
|
||||
} from "../common";
|
||||
import { getParsedPackages, assertString, assertNumber, getSystemInfo } from "../common";
|
||||
import { getTypeScript } from "../measure/getTypeScript";
|
||||
import { printSummary, measurePerf } from "../measure";
|
||||
import { summarize } from "../analysis";
|
||||
|
||||
@@ -12,11 +12,7 @@ import { printSummary } from "../measure";
|
||||
import { getTypeScript } from "../measure/getTypeScript";
|
||||
import { postInitialComparisonResults } from "../github/postInitialComparisonResults";
|
||||
import { postDependentsComparisonResult } from "../github/postDependentsComparisonResults";
|
||||
import {
|
||||
AllPackages,
|
||||
DependencyVersion,
|
||||
getAffectedPackages,
|
||||
} from "@definitelytyped/definitions-parser";
|
||||
import { AllPackages, DependencyVersion, getAffectedPackages } from "@definitelytyped/definitions-parser";
|
||||
import { execAndThrowErrors } from "@definitelytyped/utils";
|
||||
|
||||
export interface CompareOptions {
|
||||
@@ -129,25 +125,27 @@ export async function compareBenchmarks({
|
||||
typeScriptVersionMajorMinor,
|
||||
packageName,
|
||||
packageVersion,
|
||||
maxRunSeconds,
|
||||
maxRunSeconds
|
||||
}: CompareOptions): Promise<[PackageBenchmarkSummary, PackageBenchmarkSummary]> {
|
||||
await execAndThrowErrors("git checkout -f origin/master && git clean -xdf types", definitelyTypedPath);
|
||||
const baseBenchmark = (await benchmarkPackage(packageName, packageVersion.toString(), new Date(), {
|
||||
definitelyTypedPath,
|
||||
printSummary: false,
|
||||
iterations: config.benchmarks.languageServiceIterations,
|
||||
progress: false,
|
||||
tsVersion: typeScriptVersionMajorMinor,
|
||||
nProcesses: os.cpus().length,
|
||||
failOnErrors: true,
|
||||
installTypeScript: false,
|
||||
maxRunSeconds
|
||||
}))?.summary;
|
||||
const baseBenchmark = (
|
||||
await benchmarkPackage(packageName, packageVersion.toString(), new Date(), {
|
||||
definitelyTypedPath,
|
||||
printSummary: false,
|
||||
iterations: config.benchmarks.languageServiceIterations,
|
||||
progress: false,
|
||||
tsVersion: typeScriptVersionMajorMinor,
|
||||
nProcesses: os.cpus().length,
|
||||
failOnErrors: true,
|
||||
installTypeScript: false,
|
||||
maxRunSeconds
|
||||
})
|
||||
)?.summary;
|
||||
|
||||
if (!baseBenchmark) {
|
||||
throw new Error(`Package ${packageName} does not exist in master so cannot be compared.`);
|
||||
}
|
||||
|
||||
|
||||
await execAndThrowErrors(`git checkout -f . && git checkout - && git clean -xdf types`, definitelyTypedPath);
|
||||
const headBenchmark = (await benchmarkPackage(packageName, packageVersion.toString(), new Date(), {
|
||||
definitelyTypedPath,
|
||||
@@ -170,8 +168,5 @@ export async function compareBenchmarks({
|
||||
console.log("\nHEAD");
|
||||
console.log("====");
|
||||
console.log(printSummary([headBenchmark]));
|
||||
return [
|
||||
baseBenchmark,
|
||||
headBenchmark,
|
||||
];
|
||||
return [baseBenchmark, headBenchmark];
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ export function createComparisonTable(
|
||||
),
|
||||
undefined,
|
||||
{ indent: 1 }
|
||||
),
|
||||
)
|
||||
])
|
||||
);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ export function createSingleRunTable(benchmark: PackageBenchmarkSummary) {
|
||||
x.quickInfo.worst.line
|
||||
),
|
||||
{ indent: 1 }
|
||||
),
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
import { createComparisonTable, createSingleRunTable } from "./createTable";
|
||||
import {
|
||||
PackageBenchmarkSummary,
|
||||
compact,
|
||||
toPackageKey,
|
||||
packageVersionsAreEqual
|
||||
} from "../common";
|
||||
import { PackageBenchmarkSummary, compact, toPackageKey, packageVersionsAreEqual } from "../common";
|
||||
import { getInterestingMetrics, SignificanceLevel, ComparedMetric } from "../analysis";
|
||||
|
||||
export function createTablesWithAnalysesMessage(
|
||||
@@ -21,7 +16,7 @@ export function createTablesWithAnalysesMessage(
|
||||
before
|
||||
? createComparisonTable(before, after, getBeforeTitle(before, after), getAfterTitle(before, after, prNumber))
|
||||
: createSingleRunTable(after),
|
||||
``,
|
||||
``
|
||||
].join("\n");
|
||||
|
||||
return compact([
|
||||
@@ -55,21 +50,14 @@ function getBeforeTitle(before: PackageBenchmarkSummary, after: PackageBenchmark
|
||||
return `${before.packageVersionMajor}.${before.packageVersionMinor}@master`;
|
||||
}
|
||||
|
||||
function getAfterTitle(
|
||||
before: PackageBenchmarkSummary,
|
||||
after: PackageBenchmarkSummary,
|
||||
prNumber: number
|
||||
) {
|
||||
function getAfterTitle(before: PackageBenchmarkSummary, after: PackageBenchmarkSummary, prNumber: number) {
|
||||
if (packageVersionsAreEqual(before, after)) {
|
||||
return `#${prNumber}`;
|
||||
}
|
||||
return `${after.packageVersionMajor}.${after.packageVersionMinor} in #${prNumber}`;
|
||||
}
|
||||
|
||||
function getIntroMessage(
|
||||
before: PackageBenchmarkSummary | undefined,
|
||||
after: PackageBenchmarkSummary
|
||||
) {
|
||||
function getIntroMessage(before: PackageBenchmarkSummary | undefined, after: PackageBenchmarkSummary) {
|
||||
if (before && packageVersionsAreEqual(before, after)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ export async function postDependentsComparisonResult({ comparisons, dryRun }: Po
|
||||
issue_number: prNumber,
|
||||
body: createPerfCommentBody(
|
||||
{
|
||||
overallChange: getOverallChangeForComparisons(comparisons),
|
||||
overallChange: getOverallChangeForComparisons(comparisons)
|
||||
},
|
||||
message
|
||||
)
|
||||
|
||||
@@ -44,7 +44,7 @@ export async function postInitialComparisonResults({
|
||||
const currentOverallChange = getOverallChangeForComparisons(comparisons);
|
||||
const mostRecentComment = findLast(comments.data, isPerfComment);
|
||||
const commentData: CommentData = {
|
||||
overallChange: currentOverallChange,
|
||||
overallChange: currentOverallChange
|
||||
};
|
||||
if (mostRecentComment) {
|
||||
const lastOverallChange = getCommentData(mostRecentComment)?.overallChange;
|
||||
|
||||
Reference in New Issue
Block a user