aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bundler/bundle_v2.zig5
-rw-r--r--src/fs.zig8
2 files changed, 13 insertions, 0 deletions
diff --git a/src/bundler/bundle_v2.zig b/src/bundler/bundle_v2.zig
index 9502f5dfe..aad40b961 100644
--- a/src/bundler/bundle_v2.zig
+++ b/src/bundler/bundle_v2.zig
@@ -1750,6 +1750,11 @@ pub const BundleV2 = struct {
}
// TODO: remove ResolveQueue
+ //
+ // Moving this to the Bundle thread was a significant perf improvement on Linux for first builds
+ //
+ // The problem is that module resolution has many mutexes.
+ // The downside is cached resolutions are faster to do in threads since they only lock very briefly.
fn runResolutionForParseTask(parse_result: *ParseTask.Result, this: *BundleV2) ResolveQueue {
var ast = &parse_result.value.success.ast;
const source = &parse_result.value.success.source;
diff --git a/src/fs.zig b/src/fs.zig
index ee2fdff54..f85678136 100644
--- a/src/fs.zig
+++ b/src/fs.zig
@@ -885,6 +885,14 @@ pub const FileSystem = struct {
return readDirectoryWithIterator(fs, _dir, _handle, generation, store_fd, void, {});
}
+ // One of the learnings here
+ //
+ // Closing file descriptors yields significant performance benefits on Linux
+ //
+ // It was literally a 300% performance improvement to bundling.
+ // https://twitter.com/jarredsumner/status/1655787337027309568
+ // https://twitter.com/jarredsumner/status/1655714084569120770
+ // https://twitter.com/jarredsumner/status/1655464485245845506
pub fn readDirectoryWithIterator(fs: *RealFS, _dir: string, _handle: ?std.fs.Dir, generation: bun.Generation, store_fd: bool, comptime Iterator: type, iterator: Iterator) !*EntriesOption {
var dir = _dir;
var cache_result: ?allocators.Result = null;