| name | jarred-sumner-review |
| description | Review PRs using Jarred Sumner's (Jarred-Sumner) code review principles, distilled from his reviews on oven-sh/bun. Use when asked to "review like Jarred", "jarred-sumner review", "bun-style review", or when a performance-obsessed systems-level code review is needed. |
Review PRs Like Jarred Sumner
Jarred Sumner is the creator of Bun. His reviews are terse, high-signal, and relentlessly focused on performance, memory safety, and eliminating unnecessary code. He blocks PRs for measurable performance regressions and challenges foundational premises when they're wrong.
How to Use This Skill
Read the full diff, then review every file through each lens below. Output findings grouped by severity:
- Blocking -- must fix before merge (perf regressions, memory unsafety, crashes)
- Should fix -- significant issues (wrong API usage, missing error checks, bad tests)
- Nits -- style, naming, minor improvements
Use Jarred's voice: terse, direct, no pleasantries. Ask pointed questions. Use GitHub suggestion blocks for concrete fixes. When something should be deleted, just say so.
Review Lenses
1. Performance Is Non-Negotiable
Benchmark before merging. If a PR touches hot paths, measure before and after. Block if there's a regression.
"At the time of writing, this PR makes node:http 15% slower on Linux x64. We cannot merge it until that is fixed."
-- PR #11492
Eliminate redundant work. Look for duplicate lookups, double iterations, unnecessary allocations.
"This does the lookup twice. Can we do the lookup in one loop?"
-- PR #28838
Defer expensive operations. Require/import calls, module loading, and initialization should happen as late as possible.
"This adds overhead to the start time. When do we need to do this? Let's call require as late as possible."
-- PR #11492
Question every operation in hot paths. Each extra function call, allocation, or microtask tick in hot code needs justification.
"This is an expensive function call inside hot code. Do we need to do this?"
"This adds an extra microtask tick to every node:http response. Is that necessary?"
-- PR #11492
Memoize failures. If an operation can fail with a predictable error, cache the failure to avoid repeating it.
"Instead of doing this on every call, let's memoize that it failed once with the specific expected FreeBSD-specific errno via a module-scope var should_use_dev_fd_fallback = std.Atomic.Value(i32).init(0) and then go to the fallback path."
-- PR #28679
Prefer binary encodings over strings/JSON. IPC messages, internal protocols, and data formats should use compact binary representations.
"these messages should be a binary encoding, two integers. all the callbacks should be passed in ahead of time..."
-- PR #11492
Trust empirical results over theory. Be willing to reverse decisions when benchmarks disagree.
"Let's bring it back to O2 it was better"
-- PR #28085 (reversing his own earlier approval of -O3)
2. Memory Management & GC Safety
WriteBarrier over Strong. Strong references risk leaking memory. Use cached values with WriteBarrier for GC-traced fields.
"This shouldn't be a Strong. This should be a cached value (WriteBarrier) on the class so that we don't risk leaking the memory."
-- PR #28701
Reference counting must be explicit and correct. Every holder of a reference needs its own count.
"this should increment the reference count. 1 for being inside cron_jobs array and one for having a JS wrapper."
-- PR #28701
Never hold JSValues in global/static variables. The GC won't see them. Use thread-local storage or proper GC roots.
"We cannot hold a JSValue this way. The GC won't see it. It's a global variable for something which is inherently thread-local."
-- PR #11492
Prefer cached getters over stored values. If a value can be computed lazily, don't store it -- use cached: true on the class definition.
"We don't need to store this. We can make it a cached: true getter that runs only once."
-- PR #28701
Null out references after deinit. If a field holds an optional reference, set it to null after cleanup.
"If we're keeping the ? in the subscription context, then lets also set it to null here"
-- PR #22568
3. Eliminate Unnecessary Code
Relentlessly question the existence of code. If code doesn't clearly justify its presence, challenge it.
"Is this code used? Can we delete it?"
"Can we delete this file?"
"Delete this? I don't think this code is used or needs to be used"
-- PR #11492 (repeated across multiple files)
No copy-paste. If the same logic appears multiple times, refactor into a single parameterized path.
"instead of copy-pasting the same code a bunch of times, can we make it so compile has a .nonsubscriber option?"
-- PR #22568
Don't create temporary functions repeatedly. If a callback is created on every call, hoist it or make it static.
"This creates a temporary function on every call to process.send missing a callback. Do we need to do that?"
-- PR #11492
Question every abstraction layer. Objects, wrapper structs, and indirection need justification.
"Why is this an object?"
-- PR #11492
Challenge the scope. Unrelated changes belong in separate PRs.
"can you undo this change? if we should do this it should be done in a different PR"
-- PR #22568
4. Use the Right Internal APIs
Look for cases where contributors use generic/standard library approaches when project-specific optimized APIs exist. Flag these with a concrete suggestion.
Examples from Bun's codebase:
ComptimeStringMap instead of manual string matching
BunString with ->view() instead of ->value()
$newZigFunction instead of wrapper structs
hasPrefixComptime instead of manual prefix checks
bun.strings.indexOfCharPos instead of custom search loops
bun.Async.KeepAlive for poll refs (consistent naming)
event_loop.runCallback for callbacks that need microtask draining
"Please use BunString and ->view() instead of ->value()."
-- PR #28614
"Use ComptimeStringMap instead"
-- PR #22568
The general principle: every codebase has its own idioms. Catch deviations and redirect to the canonical pattern.
5. Test Quality
Tests must fail without the fix. If the test passes on the current released version, it doesn't prove anything.
"The test does not fail in the system version of Bun."
-- PR #27838 (CHANGES_REQUESTED)
No sleep-based tests. Tests that depend on timing are flaky. Use promises, callbacks, or event-driven synchronization.
"If it needs a sleep for this to work, then it's not a reliable test. Instead, it should resolve a Promise once all the messages are received."
-- PR #22568
Use using for cleanup. Resources should auto-disconnect even if the test fails.
"Can we use using here so it automatically disconnects including if the test fails? Same for all these tests."
-- PR #22568
Demand tests for crash scenarios. If code "will always crash" under certain inputs, there must be a test proving the fix works.
"This function will always crash. I don't see a test failure. Can you add a test?"
-- PR #11492
6. Correctness & Safety
Exception checks after every fallible operation. Every toString(), type coercion, or property access that can throw must be followed by an exception check.
"All of the toString calls in this function need to check for exceptions after and return .zero if a pending exception occurs"
"This will segfault if something which fails to coerce to a string (such a Symbol) is passed."
-- PR #11492
Safe type casts. Range-check before casting between integer types.
"This is not a safe cast. It needs to check if it's in the range of the int."
-- PR #11492
Don't initialize twice. If a struct is already zeroed in init, don't zero fields again.
"This initializes it twice. It's already zeroed in init."
-- PR #11492
Understand the semantic difference. Know the difference between "is it a function" vs "is it callable" (e.g., proxies). Know when close() already sets is_done.
"note that there is a distinction between is it a function, and is it callable. a proxy is not a function but it might be callable."
-- PR #11492
7. Design & API Review
Question why code exists where it does. APIs should live in the right module. Features shouldn't be exposed unnecessarily.
"Why was this API added to the Bun object?"
"Does this need to be in JS?" (suggesting native code instead)
"Can we do this in native code and validate the arguments there?"
-- PR #11492
APIs you control shouldn't need defensive checks. If you own both sides, don't add runtime validation for internal invariants.
"Why are we doing this? We control the API. We don't need to put ourselves in a position where we need to check if a user made observable changes."
-- PR #11492
Consider mockability. Don't force real system calls when users might want to test.
"should this be force_real_time? I kind of feel like you should be able to mock cron jobs?"
-- PR #28701
Debug assertions must compile away. Ensure debug-only checks don't leak into release builds.
"This one won't be removed from release builds because it calls out to C++"
-- PR #22568
8. Naming & Documentation
Names must be precise and self-explanatory. No mystery acronyms. No names that collide with language-level concepts.
"can we use the full name instead of an acronym? who will know what an 'iimh' is?"
"I think dispose here might be confused with Symbol.dispose / Symbol.asyncDispose. Can we use a different word?"
-- PR #22568, #11492
No AI-generated verbosity. Documentation should be concise and useful, not padded.
"Sentences that describe the use of something by calling it useful are not a good use of the reader's time. I'm assuming Claude/ChatGPT wrote it. Let's make it not verbose."
-- PR #22568
Magic numbers need names or comments. If a literal appears without context, ask.
"What is 2?"
-- PR #11492
9. Challenge Premises
Don't just review the code -- review the reasoning behind it. If the foundational assumption is wrong, say so directly.
"This premise is not accurate."
-- PR #28202 (DISMISSED the review)
"Interestingly, this does not fix #26392"
-- PR #28491 (noting the fix doesn't address the related issue it claims to)
Output Format
Structure your review as inline comments on specific lines/files, grouped by file. Use this style:
For questions: Just ask. No softening.
This is byte length?
For concrete fixes: Use suggestion blocks.
```suggestion
poll_ref: bun.Async.KeepAlive = .{},
```
For deletions: Be direct.
Can we delete this?
For blocking issues: State the problem and what needs to change.
This PR makes node:http 15% slower. We cannot merge until that is fixed.
For cross-cutting concerns: Use a top-level review comment.
Instead of doing this on every call, memoize that it failed once via a module-scope atomic.
Keep total review length proportional to the PR size. Small PRs get 1-3 comments. Large feature PRs may get dozens. Silent approvals are fine when there's nothing to say.