Skip to content

Commit

Permalink
fix: do not reuse suffixType if no match
Browse files Browse the repository at this point in the history
  • Loading branch information
shetzel committed Jan 9, 2025
1 parent 21478cc commit f9b2ab5
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/resolve/metadataResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,15 +370,14 @@ const resolveType =
const parseAsContentMetadataXml =
(registry: RegistryAccess) =>
(fsPath: string): boolean => {
// just like resolveType() above, check strict folders first so we don't
// have false positive matches for duplicate suffixes like "rule" or "site"
const strictFolderType = resolveTypeFromStrictFolder(registry)(fsPath);
if (strictFolderType) return true;

const suffixType = registry.getTypeBySuffix(extName(fsPath));
if (!suffixType) return false;

return fsPath.split(sep).includes(suffixType.directoryName);
const matchesSuffixType = fsPath.split(sep).includes(suffixType.directoryName);
if (matchesSuffixType) return matchesSuffixType;

// at this point, the suffixType is not a match, so check for strict folder types
return !!resolveTypeFromStrictFolder(registry)(fsPath);
};

/**
Expand Down

2 comments on commit f9b2ab5

@svc-cli-bot
Copy link
Collaborator

Choose a reason for hiding this comment

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

Benchmark

Benchmark suite Current: f9b2ab5 Previous: 21478cc Ratio
eda-componentSetCreate-linux 211 ms 221 ms 0.95
eda-sourceToMdapi-linux 1908 ms 1974 ms 0.97
eda-sourceToZip-linux 1700 ms 1732 ms 0.98
eda-mdapiToSource-linux 2587 ms 2601 ms 0.99
lotsOfClasses-componentSetCreate-linux 415 ms 431 ms 0.96
lotsOfClasses-sourceToMdapi-linux 3589 ms 3540 ms 1.01
lotsOfClasses-sourceToZip-linux 2722 ms 2796 ms 0.97
lotsOfClasses-mdapiToSource-linux 3379 ms 3372 ms 1.00
lotsOfClassesOneDir-componentSetCreate-linux 740 ms 739 ms 1.00
lotsOfClassesOneDir-sourceToMdapi-linux 6227 ms 6207 ms 1.00
lotsOfClassesOneDir-sourceToZip-linux 4983 ms 4912 ms 1.01
lotsOfClassesOneDir-mdapiToSource-linux 6088 ms 6119 ms 0.99

This comment was automatically generated by workflow using github-action-benchmark.

@svc-cli-bot
Copy link
Collaborator

Choose a reason for hiding this comment

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

Benchmark

Benchmark suite Current: f9b2ab5 Previous: 21478cc Ratio
eda-componentSetCreate-win32 698 ms 731 ms 0.95
eda-sourceToMdapi-win32 4061 ms 3967 ms 1.02
eda-sourceToZip-win32 3115 ms 3022 ms 1.03
eda-mdapiToSource-win32 6177 ms 5854 ms 1.06
lotsOfClasses-componentSetCreate-win32 1338 ms 1308 ms 1.02
lotsOfClasses-sourceToMdapi-win32 8430 ms 8111 ms 1.04
lotsOfClasses-sourceToZip-win32 5314 ms 4983 ms 1.07
lotsOfClasses-mdapiToSource-win32 8222 ms 7986 ms 1.03
lotsOfClassesOneDir-componentSetCreate-win32 2127 ms 2341 ms 0.91
lotsOfClassesOneDir-sourceToMdapi-win32 13607 ms 14280 ms 0.95
lotsOfClassesOneDir-sourceToZip-win32 8636 ms 8986 ms 0.96
lotsOfClassesOneDir-mdapiToSource-win32 13755 ms 13848 ms 0.99

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.