perf(main): trim repeated runtime hot loop work
This commit is contained in:
parent
ad6a7b1998
commit
0e82c1bdbd
1 changed files with 30 additions and 29 deletions
|
|
@ -739,18 +739,14 @@ interface ParsedBootstrapTranscriptTailCacheEntry {
|
||||||
lines: ParsedBootstrapTranscriptTailLine[];
|
lines: ParsedBootstrapTranscriptTailLine[];
|
||||||
}
|
}
|
||||||
|
|
||||||
function isNormalizedBootstrapTranscriptContextText(
|
function isNormalizedBootstrapTranscriptContextCandidateText(
|
||||||
normalizedText: string,
|
normalizedText: string,
|
||||||
normalizedTeamName: string,
|
normalizedTeamName: string
|
||||||
normalizedMemberName: string
|
|
||||||
): boolean {
|
): boolean {
|
||||||
if (!normalizedText || !normalizedTeamName || !normalizedMemberName) {
|
if (!normalizedText || !normalizedTeamName) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (
|
if (!normalizedText.includes(normalizedTeamName)) {
|
||||||
!normalizedText.includes(normalizedTeamName) ||
|
|
||||||
!normalizedText.includes(normalizedMemberName)
|
|
||||||
) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
|
@ -761,6 +757,13 @@ function isNormalizedBootstrapTranscriptContextText(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isNormalizedBootstrapTranscriptContextMemberText(
|
||||||
|
normalizedText: string,
|
||||||
|
normalizedMemberName: string
|
||||||
|
): boolean {
|
||||||
|
return !!normalizedMemberName && normalizedText.includes(normalizedMemberName);
|
||||||
|
}
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
ActiveToolCall,
|
ActiveToolCall,
|
||||||
AgentActionMode,
|
AgentActionMode,
|
||||||
|
|
@ -25952,10 +25955,7 @@ export class TeamProvisioningService {
|
||||||
return { rows: null };
|
return { rows: null };
|
||||||
}
|
}
|
||||||
|
|
||||||
const rows =
|
const rows = cached.rows.filter((row) => row.runtimeTelemetrySource !== 'windows-host');
|
||||||
this.normalizeRuntimeProcessRowsForTelemetry(cached.rows)?.filter(
|
|
||||||
(row) => row.runtimeTelemetrySource !== 'windows-host'
|
|
||||||
) ?? [];
|
|
||||||
return { rows };
|
return { rows };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -25972,10 +25972,7 @@ export class TeamProvisioningService {
|
||||||
return cached.rows;
|
return cached.rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
let rows =
|
let rows = canUseCached && cached.rows ? cached.rows : null;
|
||||||
canUseCached && cached.rows
|
|
||||||
? this.normalizeRuntimeProcessRowsForTelemetry(cached.rows)
|
|
||||||
: null;
|
|
||||||
let runtimeProcessTableAvailable = rows != null;
|
let runtimeProcessTableAvailable = rows != null;
|
||||||
try {
|
try {
|
||||||
if (!rows) {
|
if (!rows) {
|
||||||
|
|
@ -26043,7 +26040,7 @@ export class TeamProvisioningService {
|
||||||
processRows: readonly RuntimeTelemetryProcessTableRow[]
|
processRows: readonly RuntimeTelemetryProcessTableRow[]
|
||||||
): Map<number, RuntimeTelemetryProcessTableRow[]> {
|
): Map<number, RuntimeTelemetryProcessTableRow[]> {
|
||||||
const childrenByParent = new Map<number, RuntimeTelemetryProcessTableRow[]>();
|
const childrenByParent = new Map<number, RuntimeTelemetryProcessTableRow[]>();
|
||||||
for (const row of this.normalizeRuntimeProcessRowsForTelemetry(processRows) ?? []) {
|
for (const row of processRows) {
|
||||||
const current = childrenByParent.get(row.ppid) ?? [];
|
const current = childrenByParent.get(row.ppid) ?? [];
|
||||||
current.push(row);
|
current.push(row);
|
||||||
childrenByParent.set(row.ppid, current);
|
childrenByParent.set(row.ppid, current);
|
||||||
|
|
@ -26056,12 +26053,11 @@ export class TeamProvisioningService {
|
||||||
processRows: readonly RuntimeTelemetryProcessTableRow[] | null,
|
processRows: readonly RuntimeTelemetryProcessTableRow[] | null,
|
||||||
rootOwnersByPid: Map<number, Set<string>>
|
rootOwnersByPid: Map<number, Set<string>>
|
||||||
): void {
|
): void {
|
||||||
const normalizedRows = this.normalizeRuntimeProcessRowsForTelemetry(processRows);
|
if (!processRows || processRows.length === 0) {
|
||||||
if (!normalizedRows || normalizedRows.length === 0) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const row of normalizedRows) {
|
for (const row of processRows) {
|
||||||
if (process.platform === 'win32' && row.runtimeTelemetrySource === 'wsl') {
|
if (process.platform === 'win32' && row.runtimeTelemetrySource === 'wsl') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -30549,15 +30545,20 @@ export class TeamProvisioningService {
|
||||||
}
|
}
|
||||||
const lineNormalizedText = normalizedText ?? '';
|
const lineNormalizedText = normalizedText ?? '';
|
||||||
if (shouldCollectBootstrapContext) {
|
if (shouldCollectBootstrapContext) {
|
||||||
for (const contextMemberName of normalizedContextMemberNames) {
|
const isBootstrapContextLine = isNormalizedBootstrapTranscriptContextCandidateText(
|
||||||
if (
|
lineNormalizedText,
|
||||||
isNormalizedBootstrapTranscriptContextText(
|
normalizedTeamName
|
||||||
lineNormalizedText,
|
);
|
||||||
normalizedTeamName,
|
if (isBootstrapContextLine) {
|
||||||
contextMemberName
|
for (const contextMemberName of normalizedContextMemberNames) {
|
||||||
)
|
if (
|
||||||
) {
|
isNormalizedBootstrapTranscriptContextMemberText(
|
||||||
bootstrapContextMembers.add(contextMemberName);
|
lineNormalizedText,
|
||||||
|
contextMemberName
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
bootstrapContextMembers.add(contextMemberName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue