Skip to content

perf(selectivity): speed up pre-test checks#1211

Merged
KuznetsovRoman merged 1 commit intomasterfrom
TESTPLANE-904.calc_hash_in_worker
Feb 27, 2026
Merged

perf(selectivity): speed up pre-test checks#1211
KuznetsovRoman merged 1 commit intomasterfrom
TESTPLANE-904.calc_hash_in_worker

Conversation

@KuznetsovRoman
Copy link
Member

@KuznetsovRoman KuznetsovRoman commented Feb 24, 2026

No description provided.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 24, 2026

Open in StackBlitz

npm i https://pkg.pr.new/gemini-testing/testplane@1211

commit: 167bf4d

@KuznetsovRoman KuznetsovRoman force-pushed the TESTPLANE-904.calc_hash_in_worker branch 2 times, most recently from 13cbd78 to d9d5c75 Compare February 26, 2026 15:40
@KuznetsovRoman KuznetsovRoman changed the title chore(selectivity): calc hashes in workers before test run perf(selectivity): speed up pre-test checks Feb 27, 2026
async getTestChangedDeps(testDeps: NormalizedDependencies): Promise<NormalizedDependencies | null> {
const depFileTypes: Array<keyof NormalizedDependencies> = ["css", "js", "modules"] as const;
const result: NormalizedDependencies = { css: [], js: [], modules: [] };
const fileContents = await this._getHashFileContents();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awaiting here in order to not create extra promises for every file

}
}),
);
for (const filePath of testDeps[depFileType]) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"for of" is faster than "Promise.all(deps.map)" here

private readonly _selectivityHashesPath: string;
private readonly _compresion: SelectivityCompressionType;
private _hashFileContents: Promise<HashFileContents> | null = null;
private _fileStateCache = new Map<string, boolean>();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Is file changed" cache

Comment on lines +84 to 86
clearCache(): void {
this._fileStateCache.clear();
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After all checks are passed, we can free up this memory before tests are run

@KuznetsovRoman KuznetsovRoman force-pushed the TESTPLANE-904.calc_hash_in_worker branch from d9d5c75 to 6999fb8 Compare February 27, 2026 13:47
@KuznetsovRoman KuznetsovRoman merged commit caede70 into master Feb 27, 2026
6 checks passed
@KuznetsovRoman KuznetsovRoman deleted the TESTPLANE-904.calc_hash_in_worker branch February 27, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants