Skip to content

Commit 50ea29c

Browse files
committed
restore aggregate-first branch order in shouldTrace
V8 inlines executeField slightly better when the never-taken-on-Node branch is the trailing fallback rather than an early-returning if body. The flipped form cost ~5% on introspection; the original ordering plus c8 ignore start/stop over the Bun-only branch keeps both 100% coverage and the perf characteristics.
1 parent cab8dd6 commit 50ea29c

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/diagnostics.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,12 @@ export function shouldTrace(
150150
return false;
151151
}
152152
const aggregate = channel.hasSubscribers;
153-
/* c8 ignore next 3: Bun-only fallback, exercised by integrationTests/diagnostics-bun. */
154-
if (aggregate === undefined) {
155-
return SUB_CHANNEL_KEYS.some((key) => channel[key].hasSubscribers === true);
153+
/* c8 ignore start: Bun-only fallback, exercised by integrationTests/diagnostics-bun. */
154+
if (aggregate !== undefined) {
155+
return aggregate;
156156
}
157-
return aggregate;
157+
return SUB_CHANNEL_KEYS.some((key) => channel[key].hasSubscribers);
158+
/* c8 ignore stop */
158159
}
159160

160161
/**

0 commit comments

Comments
 (0)