diff --git a/bench/hot-module-reloading/css-stress-test/color-looper.emotion.zig b/bench/hot-module-reloading/css-stress-test/color-looper.emotion.zig index bc3b525d03..884e558e74 100644 --- a/bench/hot-module-reloading/css-stress-test/color-looper.emotion.zig +++ b/bench/hot-module-reloading/css-stress-test/color-looper.emotion.zig @@ -25,7 +25,7 @@ pub var all_timestamps: [RUN_COUNT + 1]usize = undefined; // 1. file path // 2. Byte offset in file // 3. ms update interval -var color_buf: [8096 + SIMULATE_LONG_FILE.len]u8 = undefined; +var color_buf: [8192 + SIMULATE_LONG_FILE.len]u8 = undefined; pub fn main() anyerror!void { var allocator = std.heap.c_allocator; diff --git a/bench/hot-module-reloading/css-stress-test/color-looper.zig b/bench/hot-module-reloading/css-stress-test/color-looper.zig index a1483a2f30..10aadcbc81 100644 --- a/bench/hot-module-reloading/css-stress-test/color-looper.zig +++ b/bench/hot-module-reloading/css-stress-test/color-looper.zig @@ -25,7 +25,7 @@ pub var all_timestamps: [RUN_COUNT + 1]usize = undefined; // 1. file path // 2. Byte offset in file // 3. ms update interval -var color_buf: [8096 + SIMULATE_LONG_FILE.len]u8 = undefined; +var color_buf: [8192 + SIMULATE_LONG_FILE.len]u8 = undefined; pub fn main() anyerror!void { var allocator = std.heap.c_allocator; diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 58a670ceb2..07303bff33 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -16,9 +16,9 @@ If you see an error like this: ![image](https://user-images.githubusercontent.com/709451/141210854-89434678-d21b-42f4-b65a-7df3b785f7b9.png) -It usually means the max number of open file descriptors is being explicitly set to a low number. By default, Bun requests the max number of file descriptors available (which on macOS, is something like 32,000). But, if you previously ran into ulimit issues with, e.g., Chokidar, someone on The Internet may have advised you to run `ulimit -n 8096`. +It usually means the max number of open file descriptors is being explicitly set to a low number. By default, Bun requests the max number of file descriptors available (which on macOS, is something like 32,000). But, if you previously ran into ulimit issues with, e.g., Chokidar, someone on The Internet may have advised you to run `ulimit -n 8192`. -That advice unfortunately **lowers** the hard limit to `8096`. This can be a problem in large repositories or projects with lots of dependencies. Chokidar (and other watchers) don’t seem to call `setrlimit`, which means they’re reliant on the (much lower) soft limit. +That advice unfortunately **lowers** the hard limit to `8192`. This can be a problem in large repositories or projects with lots of dependencies. Chokidar (and other watchers) don’t seem to call `setrlimit`, which means they’re reliant on the (much lower) soft limit. To fix this issue: diff --git a/misctools/readlink-getfd.zig b/misctools/readlink-getfd.zig index 5a1d8208e4..36d6ef6583 100644 --- a/misctools/readlink-getfd.zig +++ b/misctools/readlink-getfd.zig @@ -20,7 +20,7 @@ pub fn main() anyerror!void { Output.Source.set(&output_source); defer Output.flush(); - var args_buffer: [8096 * 2]u8 = undefined; + var args_buffer: [8192 * 2]u8 = undefined; var fixed_buffer = std.heap.FixedBufferAllocator.init(&args_buffer); var allocator = fixed_buffer.allocator(); diff --git a/misctools/readlink-realpath.zig b/misctools/readlink-realpath.zig index db94094e0c..905f4394c0 100644 --- a/misctools/readlink-realpath.zig +++ b/misctools/readlink-realpath.zig @@ -20,7 +20,7 @@ pub fn main() anyerror!void { Output.Source.set(&output_source); defer Output.flush(); - var args_buffer: [8096 * 2]u8 = undefined; + var args_buffer: [8192 * 2]u8 = undefined; var fixed_buffer = std.heap.FixedBufferAllocator.init(&args_buffer); var allocator = fixed_buffer.allocator(); diff --git a/packages/bun-wasm/index.ts b/packages/bun-wasm/index.ts index 9802d537e4..e5db09084a 100644 --- a/packages/bun-wasm/index.ts +++ b/packages/bun-wasm/index.ts @@ -176,7 +176,7 @@ export class Bun { return Bun.wasm_source.instance.exports.memory as WebAssembly.Memory; } - private static scratch: Uint8Array = new Uint8Array(8096); + private static scratch: Uint8Array = new Uint8Array(8192); private static memory_array: Uint8Array; private static _decoder: TextDecoder; diff --git a/src/bun.js/api/bun/subprocess.zig b/src/bun.js/api/bun/subprocess.zig index 6e099000b5..4fde1e8a62 100644 --- a/src/bun.js/api/bun/subprocess.zig +++ b/src/bun.js/api/bun/subprocess.zig @@ -955,7 +955,7 @@ pub const Subprocess = struct { pub fn readAll(this: *BufferedOutput) void { if (this.auto_sizer) |auto_sizer| { while (@as(usize, this.internal_buffer.len) < auto_sizer.max and this.status == .pending) { - var stack_buffer: [8096]u8 = undefined; + var stack_buffer: [8192]u8 = undefined; const stack_buf: []u8 = stack_buffer[0..]; var buf_to_use = stack_buf; const available = this.internal_buffer.available(); diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig index 1711c34b0c..415171ffe1 100644 --- a/src/bun.js/api/server.zig +++ b/src/bun.js/api/server.zig @@ -5754,7 +5754,7 @@ pub fn NewServer(comptime NamespaceType: type, comptime ssl_enabled_: bool, comp this.pending_requests += 1; defer this.pending_requests -= 1; req.setYield(false); - var stack_fallback = std.heap.stackFallback(8096, this.allocator); + var stack_fallback = std.heap.stackFallback(8192, this.allocator); const allocator = stack_fallback.get(); const buffer_writer = js_printer.BufferWriter.init(allocator) catch unreachable; diff --git a/src/bun.js/node/node_fs.zig b/src/bun.js/node/node_fs.zig index 21b00fb1b9..ffda3e9566 100644 --- a/src/bun.js/node/node_fs.zig +++ b/src/bun.js/node/node_fs.zig @@ -5140,7 +5140,7 @@ pub const NodeFS = struct { total += amt; // There are cases where stat()'s size is wrong or out of date if (total > size and amt != 0) { - buf.ensureUnusedCapacity(8096) catch unreachable; + buf.ensureUnusedCapacity(8192) catch unreachable; buf.expandToCapacity(); continue; } @@ -5161,7 +5161,7 @@ pub const NodeFS = struct { total += amt; // There are cases where stat()'s size is wrong or out of date if (total > size and amt != 0) { - buf.ensureUnusedCapacity(8096) catch unreachable; + buf.ensureUnusedCapacity(8192) catch unreachable; buf.expandToCapacity(); continue; } diff --git a/src/bun.js/node/node_os.zig b/src/bun.js/node/node_os.zig index cf84b3d506..0bbbda5888 100644 --- a/src/bun.js/node/node_os.zig +++ b/src/bun.js/node/node_os.zig @@ -112,7 +112,7 @@ pub const Os = struct { // TODO: remove all usages of file.reader(). zig's std.io.Reader() // is extremely slow and should rarely ever be used in Bun until // that is fixed. - var buffered_reader = std.io.BufferedReader(8096, @TypeOf(file.reader())){ .unbuffered_reader = file.reader() }; + var buffered_reader = std.io.BufferedReader(8192, @TypeOf(file.reader())){ .unbuffered_reader = file.reader() }; var reader = buffered_reader.reader(); // Skip the first line (aggregate of all CPUs) @@ -155,7 +155,7 @@ pub const Os = struct { // TODO: remove all usages of file.reader(). zig's std.io.Reader() // is extremely slow and should rarely ever be used in Bun until // that is fixed. - var buffered_reader = std.io.BufferedReader(8096, @TypeOf(file.reader())){ .unbuffered_reader = file.reader() }; + var buffered_reader = std.io.BufferedReader(8192, @TypeOf(file.reader())){ .unbuffered_reader = file.reader() }; var reader = buffered_reader.reader(); const key_processor = "processor\t: "; diff --git a/src/bun.js/webcore/streams.zig b/src/bun.js/webcore/streams.zig index 5c648a6232..41218dd7fb 100644 --- a/src/bun.js/webcore/streams.zig +++ b/src/bun.js/webcore/streams.zig @@ -4046,7 +4046,7 @@ pub fn NewFIFO(comptime EventLoop: JSC.EventLoopKind) type { if (sizeOrOffset > 0) { this.buf = auto_sizer.resize(@as(usize, @intCast(sizeOrOffset))) catch return; } else { - this.buf = auto_sizer.resize(8096) catch return; + this.buf = auto_sizer.resize(8192) catch return; } } } diff --git a/src/bundler.zig b/src/bundler.zig index 0ba3992f67..d88ac80f50 100644 --- a/src/bundler.zig +++ b/src/bundler.zig @@ -991,7 +991,7 @@ pub const Bundler = struct { }; const build_ctx = CSSBuildContext{ .origin = bundler.options.origin }; - const BufferedWriter = std.io.CountingWriter(std.io.BufferedWriter(8096, std.fs.File.Writer)); + const BufferedWriter = std.io.CountingWriter(std.io.BufferedWriter(8192, std.fs.File.Writer)); const CSSWriter = Css.NewWriter( BufferedWriter.Writer, @TypeOf(&bundler.linker), diff --git a/src/bundler/entry_points.zig b/src/bundler/entry_points.zig index 86bc2369cb..5b76d439e5 100644 --- a/src/bundler/entry_points.zig +++ b/src/bundler/entry_points.zig @@ -8,7 +8,7 @@ const Bundler = bun.Bundler; const strings = bun.strings; pub const FallbackEntryPoint = struct { - code_buffer: [8096]u8 = undefined, + code_buffer: [8192]u8 = undefined, path_buffer: [bun.MAX_PATH_BYTES]u8 = undefined, source: logger.Source = undefined, built_code: string = "", @@ -74,7 +74,7 @@ pub const FallbackEntryPoint = struct { }; pub const ClientEntryPoint = struct { - code_buffer: [8096]u8 = undefined, + code_buffer: [8192]u8 = undefined, path_buffer: [bun.MAX_PATH_BYTES]u8 = undefined, source: logger.Source = undefined, diff --git a/src/cli/create_command.zig b/src/cli/create_command.zig index 0bb3e35cfc..df48d36b09 100644 --- a/src/cli/create_command.zig +++ b/src/cli/create_command.zig @@ -1852,7 +1852,7 @@ pub const Example = struct { const http_proxy: ?URL = env_loader.getHttpProxy(api_url); const mutable = try ctx.allocator.create(MutableString); - mutable.* = try MutableString.init(ctx.allocator, 8096); + mutable.* = try MutableString.init(ctx.allocator, 8192); // ensure very stable memory address var async_http: *HTTP.AsyncHTTP = ctx.allocator.create(HTTP.AsyncHTTP) catch unreachable; diff --git a/src/http.zig b/src/http.zig index 1958c318ba..42529d43b6 100644 --- a/src/http.zig +++ b/src/http.zig @@ -850,7 +850,7 @@ pub const HTTPThread = struct { const log = Output.scoped(.fetch, false); -var temp_hostname: [8096]u8 = undefined; +var temp_hostname: [8192]u8 = undefined; pub fn checkServerIdentity( client: *HTTPClient, diff --git a/src/http/websocket.zig b/src/http/websocket.zig index ce8b38ebbb..4a41e27c53 100644 --- a/src/http/websocket.zig +++ b/src/http/websocket.zig @@ -147,7 +147,7 @@ pub const Websocket = struct { stream: std.net.Stream, err: ?anyerror = null, - buf: [8096]u8 = undefined, + buf: [8192]u8 = undefined, read_stream: ReadStream, reader: ReadStream.Reader, flags: u32 = 0, diff --git a/src/js_ast.zig b/src/js_ast.zig index 5bec4dce2b..13c3fc9396 100644 --- a/src/js_ast.zig +++ b/src/js_ast.zig @@ -7378,9 +7378,7 @@ pub const Macro = struct { }; pub const ASTMemoryAllocator = struct { - stack_allocator: std.heap.StackFallbackAllocator( - if (std.mem.page_size > 8096) 8096 else std.mem.page_size, - ) = undefined, + stack_allocator: std.heap.StackFallbackAllocator(@min(8192, std.mem.page_size)) = undefined, bump_allocator: std.mem.Allocator = undefined, allocator: std.mem.Allocator, previous: ?*ASTMemoryAllocator = null, diff --git a/src/report.zig b/src/report.zig index 741316a1a5..0ebc562121 100644 --- a/src/report.zig +++ b/src/report.zig @@ -519,7 +519,7 @@ pub noinline fn globalError(err: anyerror, trace_: @TypeOf(@errorReturnTrace())) if (comptime Environment.isPosix) { const limit = std.os.getrlimit(.NOFILE) catch std.mem.zeroes(std.os.rlimit); - if (limit.cur > 0 and limit.cur < (8096 * 2)) { + if (limit.cur > 0 and limit.cur < (8192 * 2)) { Output.prettyError( \\ \\error: An unknown error ocurred, possibly due to low max file descriptors (Unexpected) diff --git a/src/sourcemap/vlq_bench.zig b/src/sourcemap/vlq_bench.zig index 4da9db8ff1..9476e77c20 100644 --- a/src/sourcemap/vlq_bench.zig +++ b/src/sourcemap/vlq_bench.zig @@ -203,10 +203,10 @@ pub fn main() anyerror!void { std.debug.print("[{d}] ILEB128 decode: {} in {}\n", .{ how_many, std.fmt.fmtIntSizeDec(byte_size), std.fmt.fmtDuration(elapsed) }); } - std.debug.print("\nNumbers between 0 - 8096:\n\n", .{}); + std.debug.print("\nNumbers between 0 - 8192:\n\n", .{}); for (numbers, 0..) |_, i| { - numbers[i] = rand.random().intRangeAtMost(i32, 0, 8096); + numbers[i] = rand.random().intRangeAtMost(i32, 0, 8192); } { diff --git a/src/watcher.zig b/src/watcher.zig index 0083917b32..9f4d75ef64 100644 --- a/src/watcher.zig +++ b/src/watcher.zig @@ -24,7 +24,7 @@ pub const WatchItemIndex = u16; const NoWatchItem: WatchItemIndex = std.math.maxInt(WatchItemIndex); const PackageJSON = @import("./resolver/package_json.zig").PackageJSON; -const WATCHER_MAX_LIST = 8096; +const WATCHER_MAX_LIST = 8192; pub const INotify = struct { pub const IN_CLOEXEC = std.os.O.CLOEXEC; diff --git a/test/js/web/web-globals.test.js b/test/js/web/web-globals.test.js index 8151d5910a..b45fc2fbd7 100644 --- a/test/js/web/web-globals.test.js +++ b/test/js/web/web-globals.test.js @@ -129,7 +129,7 @@ it("crypto.getRandomValues", () => { }); // run it on a large input - expect(!!crypto.getRandomValues(new Uint8Array(8096)).find(a => a > 0)).toBe(true); + expect(!!crypto.getRandomValues(new Uint8Array(8192)).find(a => a > 0)).toBe(true); { // any additional input into getRandomValues() makes it unbuffered