aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jarred SUmner <jarred@jarredsumner.com> 2021-10-04 20:01:05 -0700
committerGravatar Jarred SUmner <jarred@jarredsumner.com> 2021-10-04 20:01:05 -0700
commit21d918921a676fd14449e64a588123d7357f9ea9 (patch)
tree129924438055ac4a93119eb97215285546fd4cf3 /src
parent55095edee6a72fdbf6e40787981b096baa8c7884 (diff)
downloadbun-jarred/fix-bunbun-on-wsl.tar.gz
bun-jarred/fix-bunbun-on-wsl.tar.zst
bun-jarred/fix-bunbun-on-wsl.zip
memfd experiment did not yield perf gains on Linuxjarred/fix-bunbun-on-wsl
I suspect the reason why is because we were already using tmpfs. So it was already writing to an in-memory file. O_TMPFILE doesn't seem to do anything for us either here.
Diffstat (limited to 'src')
-rw-r--r--src/bundler.zig2
-rw-r--r--src/fs.zig7
2 files changed, 4 insertions, 5 deletions
diff --git a/src/bundler.zig b/src/bundler.zig
index 89c37e9ab..2ca075760 100644
--- a/src/bundler.zig
+++ b/src/bundler.zig
@@ -700,7 +700,7 @@ pub const Bundler = struct {
const tmpname = try bundler.fs.tmpname(
".bun",
std.mem.span(&tmpname_buf),
- std.hash.Wyhash.hash(0, std.mem.span(destination)),
+ std.hash.Wyhash.hash(@intCast(usize, std.time.milliTimestamp()) % std.math.maxInt(u32), std.mem.span(destination)),
);
var tmpfile = Fs.FileSystem.RealFS.Tmpfile{};
diff --git a/src/fs.zig b/src/fs.zig
index 75d01149d..0b28fa9b7 100644
--- a/src/fs.zig
+++ b/src/fs.zig
@@ -534,12 +534,11 @@ pub const FileSystem = struct {
}
pub fn create(this: *Tmpfile, rfs: *RealFS, name: [*:0]const u8) !void {
- var tmpdir_ = if (Environment.isLinux) try rfs.openDir(rfs.parent_fs.top_level_dir) else try rfs.openTmpDir();
+ var tmpdir_ = try rfs.openTmpDir();
- const default_flags = std.os.O_CREAT | std.os.O_RDWR | std.os.O_CLOEXEC;
- const flags = if (Environment.isLinux) default_flags | std.os.O_TMPFILE else default_flags | std.os.O_EXCL;
+ const flags = std.os.O_CREAT | std.os.O_RDWR | std.os.O_CLOEXEC;
this.dir_fd = tmpdir_.fd;
- this.fd = try std.os.openatZ(tmpdir_.fd, name, flags, 0666);
+ this.fd = try std.os.openatZ(tmpdir_.fd, name, flags, std.os.S_IRWXO);
}
pub fn promote(this: *Tmpfile, from_name: [*:0]const u8, destination_fd: std.os.fd_t, name: [*:0]const u8) !void {