js-assistant icon indicating copy to clipboard operation
js-assistant copied to clipboard

Code Action Idea: Parallelize Awaits

Open hediet opened this issue 3 years ago • 2 comments

await writeFile(ancestorUri, 'some content');
await writeFile(input1Uri, 'some content');
await writeFile(input2Uri, 'some content');
await writeFile(resultUri, 'some content');

<->

Promise.all([
    writeFile(ancestorUri, 'some content'),
    writeFile(input1Uri, 'some content'),
    writeFile(input2Uri, 'some content'),
    writeFile(resultUri, 'some content'),
])

Ideally with detection if there are any dependencies

hediet avatar Jun 01 '22 12:06 hediet

Thanks for the suggestion! What "dependencies" are you referring to here?

lgrammel avatar Jun 01 '22 13:06 lgrammel

For example in this case:

const result1 = await writeFile(ancestorUri, 'some content');
const result2 = await writeFile(ancestorUri, 'some content');
await writeFile(input1Uri, result1 + result2);

hediet avatar Jun 01 '22 13:06 hediet