Commit 39a85450 authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

[piexwasm] test.js: Promise.all write the images to the file system

Use Promise.all to write the test image files to the file system. This
allows the writes to happen in parallel. Test setup time before: 3 sec
and after: 2.2 sec.

The setup time is HTML fetch-bound, not I/O bound, and parallel writes
only improve the I/O (write speed) component of the setup time.

Bug: 935285
Change-Id: I872a111477c6fff1c692d45ed3b93d6b68d6d476
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1562810Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Auto-Submit: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#649740}
parent bc31ee1a
......@@ -95,11 +95,11 @@ const puppeteer = require('puppeteer');
return window.createFileSystem(length);
}, images.length);
for (let i = 0; i < images.length; ++i) {
await page.evaluate((image) => {
await Promise.all(images.map((image) => {
return page.evaluate((image) => {
return window.writeToFileSystem(image);
}, images[i]);
}
}, image);
}));
await page.evaluate(() => {
window.testTime = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment