Do fs calls in parallel

This commit is contained in:
Alex Dima 2022-04-20 16:37:56 +03:00
parent a045f3f48a
commit b9e8734a7b
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9

View file

@ -332,26 +332,31 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
// create trie to enable fast 'filename -> extension id' look up
public async getExtensionPathIndex(): Promise<TernarySearchTree<URI, IExtensionDescription>> {
if (!this._extensionPathIndex) {
this._extensionPathIndex = (async () => {
const tst = TernarySearchTree.forUris<IExtensionDescription>(key => {
// using the default/biased extUri-util because the IExtHostFileSystemInfo-service
// isn't ready to be used yet, e.g the knowledge about `file` protocol and others
// comes in while this code runs
return extUriBiasedIgnorePathCase.ignorePathCasing(key);
});
// const tst = TernarySearchTree.forUris<IExtensionDescription>(key => true);
for (const ext of this._myRegistry.getAllExtensionDescriptions()) {
if (this._getEntryPoint(ext)) {
const uri = await this._realPathExtensionUri(ext.extensionLocation);
tst.set(uri, ext);
}
}
return tst;
})();
this._extensionPathIndex = this._createExtensionPathIndex(this._myRegistry.getAllExtensionDescriptions());
}
return this._extensionPathIndex;
}
/**
* create trie to enable fast 'filename -> extension id' look up
*/
private async _createExtensionPathIndex(extensions: IExtensionDescription[]): Promise<TernarySearchTree<URI, IExtensionDescription>> {
const tst = TernarySearchTree.forUris<IExtensionDescription>(key => {
// using the default/biased extUri-util because the IExtHostFileSystemInfo-service
// isn't ready to be used yet, e.g the knowledge about `file` protocol and others
// comes in while this code runs
return extUriBiasedIgnorePathCase.ignorePathCasing(key);
});
// const tst = TernarySearchTree.forUris<IExtensionDescription>(key => true);
await Promise.all(this._myRegistry.getAllExtensionDescriptions().map(async (ext) => {
if (this._getEntryPoint(ext)) {
const uri = await this._realPathExtensionUri(ext.extensionLocation);
tst.set(uri, ext);
}
}));
return tst;
}
private _deactivate(extensionId: ExtensionIdentifier): Promise<void> {
let result = Promise.resolve(undefined);