mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
minor perf optimization: remove this loop on macOS
This commit is contained in:
@@ -84,3 +84,5 @@ pub const disable_compression_in_http_client = false;
|
||||
// Time (mean ± σ): 306.7 ms ± 6.1 ms [User: 31.7 ms, System: 269.8 ms]
|
||||
// Range (min … max): 299.5 ms … 318.8 ms 10 runs
|
||||
pub const use_libgit2 = true;
|
||||
|
||||
pub const atomic_file_watcher = env.isLinux;
|
||||
|
||||
@@ -532,10 +532,12 @@ pub fn NewWatcher(comptime ContextType: type) type {
|
||||
comptime copy_file_path: bool,
|
||||
) !void {
|
||||
if (this.indexOf(hash)) |index| {
|
||||
// On Linux, the file descriptor might be out of date.
|
||||
if (fd > 0) {
|
||||
var fds = this.watchlist.items(.fd);
|
||||
fds[index] = fd;
|
||||
if (comptime FeatureFlags.atomic_file_watcher) {
|
||||
// On Linux, the file descriptor might be out of date.
|
||||
if (fd > 0) {
|
||||
var fds = this.watchlist.items(.fd);
|
||||
fds[index] = fd;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user