зеркало из https://github.com/microsoft/backfill.git
Speeding up hasher by reducing wasted calculations (#399)
* speeding up the hasher by reducing wasted calculations * Change files
This commit is contained in:
Родитель
6fa1c1a6a3
Коммит
52711efb56
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"type": "patch",
|
||||
"comment": "speeding up the hasher by reducing wasted calculations",
|
||||
"packageName": "backfill-hasher",
|
||||
"email": "kchau@microsoft.com",
|
||||
"dependentChangeType": "patch",
|
||||
"date": "2022-01-06T22:58:42.192Z"
|
||||
}
|
|
@ -23,8 +23,12 @@ export async function generateHashOfFiles(
|
|||
): Promise<string> {
|
||||
const { repoHashes, root } = repoInfo;
|
||||
|
||||
const normalized = path.normalize(packageRoot) + sep;
|
||||
|
||||
const files: string[] = Object.keys(repoHashes).filter((f) =>
|
||||
path.join(root, f).includes(path.normalize(packageRoot) + sep)
|
||||
// purposefully using string concat here to speed up the checks since root and f
|
||||
// are well formatted from "getWorkspaceRoot" and "repoHashes"
|
||||
(root + sep + f).includes(normalized)
|
||||
);
|
||||
|
||||
files.sort((a, b) => a.localeCompare(b));
|
||||
|
|
Загрузка…
Ссылка в новой задаче