devserver: skip unlink when possible#2115
devserver: skip unlink when possible#2115dmiller-figma wants to merge 3 commits intoaspect-build:mainfrom
Conversation
|
js/private/js_run_devserver.mjs
Outdated
| console.error(`Dst exists: ${exists}`) | ||
| } | ||
| if (exists) { | ||
| await fs.promises.unlink(dst) |
There was a problem hiding this comment.
Don't we need to keep this when !grant_sandbox_write_permissions?
|
|


Without this change we incur the cost of an extra unnecessary syscall on every file we need to sync. In my testing this didn't make a perceivable difference with small sets of changed files, however it could make a difference on large ones.
This change works just fine on Linux. However, on macOS you get a permission error if you try to copy over an existing file without
grant_sandbox_write_permissions = True. So on macOS we only enable this optimization ifgrant_sandbox_write_permissions == True, otherwise weunlinkthe file like we did before.Changes are visible to end-users: no
Test plan
Existing tests
If it is possible to write a test that only runs on macOS, we could test that code path. However, I'm not sure how feasible that is.