GoogleChromeLabs / browser-fs-access

File System Access API with legacy fallback in the browser
https://googlechromelabs.github.io/browser-fs-access/demo/
Apache License 2.0
1.38k stars 84 forks source link

Parallelise operations #9

Closed RReverser closed 4 years ago

RReverser commented 4 years ago

Before this, reading multiple files or directories has been done serially, even though Native File System provides a Promise-based API.

This PR leverages the API to full extent by scheduling all reads in parallel, and then waiting for all results.

On an example of a folder with 100 files, this makes the "open directory" demo go down from 90ms to 60ms (1.5x speedup) on my machine, and will be even better on larger lists.

tomayac commented 4 years ago

Actually, it looks like the ability to select multiple directories was now removed: https://wicg.github.io/native-file-system/#dictdef-directorypickeroptions. The UI would never let you pick multiple directories (the legacy method does), but the option was there. I will simplify the code accordingly.