OpenCloud · Upload performance
Uploads with 10,000 files: from 11 seconds to milliseconds
During uploads of ten thousand files, the OpenCloud web interface froze for seconds because several places in the browser did a quadratic amount of work. Batch calls instead of single steps, name lookups instead of nested loops and throttled re-rendering bring individual steps from over eleven seconds down to a few milliseconds. The patterns behind this show up in many single-page apps.
It started with an issue from November: when you dragged a folder with ten thousand files into OpenCloud, the transfer ran through and was followed by a page that didn't respond for seconds, as if it had crashed. The network and server weren't the problem. The time was lost in the browser, in code that ran alongside the actual upload and whose cost grew quadratically, not linearly, with every additional file. None of the spots found in the end was an obvious bug. With a few dozen files they all ran unnoticed.
They were found with benchmarks in Vitest that run against real Pinia stores instead of mocks, supplemented by measurements in headless Chromium, with the results recorded in the pull requests:
| Step | before | after |
|---|---|---|
| Finish 10,000 files after upload | 11.6 s | 3.7 ms |
| Check conflicts, 10,000 files into a folder with 10,000 entries | 11.5 s | 4.0 ms |
| Check quota, same size | 11.6 s | 11.9 ms |
| Resolve 5,000 conflicts with “Keep both” | 1.7 s | 8.4 ms |
| Progress display with 1,000 entries, compute time | 3.5 s | 6 ms |
| Read a folder with 100 × 100 files | 1.3 s | 0.7 s |
Batch calls instead of single steps in Uppy
The most expensive item was at the end of the upload. After a successful transfer, the web interface removed each file individually from the upload library Uppy. Each of these steps copied the library's entire state. Ten thousand files therefore meant ten thousand copies of an object with ten thousand entries. A single call that removes all files at once brings the step from 11.6 seconds down to 3.7 milliseconds. Resolving five thousand name conflicts with “Keep both” took 1.7 seconds for related reasons and now takes 8.4 milliseconds.
Name lookup instead of nested loops
Before the upload, the web interface checks whether files with the same name already exist at the destination and whether the quota is sufficient. The conflict check compared every new file with the entire content of the destination folder, which for ten thousand files going into an equally large folder added up to a hundred million comparisons. A lookup of the existing names, built once per upload, turns that into ten thousand lookups. The quota check uses the same lookup instead of searching the folder again for each file. Files inside a dragged folder skip the search entirely, because they can't exist at the destination yet. Following the same pattern, the web interface now checks whether a file added during a running upload is already being transferred.
Fewer re-renders
During the upload, every progress event triggered a re-render of the entire list, even though at most one row had changed, and Uppy fires such events for every file and every transferred chunk. The display now updates at most every 500 milliseconds, the interval at which Uppy itself reports overall progress and which is enough for the human eye. Each row is also its own component that only re-renders when its own upload changes; with a thousand entries, the number of re-renders in the measurement dropped from 200,000 to zero. The web interface now reads a dragged folder concurrently instead of sequentially, with up to fifty file system accesses at once and in unchanged order, which nearly halves the time for a tree of a hundred folders with a hundred files each.
Less load on the server
Two changes concern the relationship between browser and server. A dragged folder tree has to be created on the server before the files follow. Until now, all subfolders of one level were created at the same time, which could trigger hundreds of parallel requests and a wave of events to all connected clients. The web interface now creates at most five folders at once. After the upload, it also no longer reloads the entire destination folder, but only queries the uploaded top-level entries, so a dragged folder with thousands of files triggers a single request at the end. It keeps the full sync for the cases where it is cheaper or necessary: with more than twenty top-level entries, with canceled uploads and in encrypted vaults.
The patterns behind this appear in many single-page apps. If you build a web extension for OpenCloud or another application with long lists, you'll probably find them in your own code too: loops over lists inside loops over lists, state changes per item instead of in batches, and re-rendering on every event instead of at the pace of what a person can perceive. They only become visible with test data at a realistic size.
Sources
- Improve performance of uploads with many files, GitHub, 2026-11-11
- perf: avoid quadratic work when uploading many files, GitHub, 2026-11-25
- perf: throttle upload info and read dropped folders concurrently, GitHub, 2026-12-03
- perf: limit parallel folder create requests, prevent folder reload after upload, GitHub, 2026-12-03