Commit Graph

9 Commits

Author SHA1 Message Date
autofix-ci[bot]
d9336cb9ea [autofix.ci] apply automated fixes 2025-09-02 12:25:15 +00:00
Claude Bot
bbf539be04 feat: implement performance.timerify() with native 'function' entry type support
Implements Node.js-compatible performance.timerify() following the exact
behavior from Node.js source (vendor/node/lib/internal/perf/timerify.js).

Key implementation details matching Node.js:
- Line 44: Creates 'function' type entries (same as Node.js)
- Line 52: Calls enqueue() to notify observers (same as Node.js)
- Line 72-76: Handles constructor vs regular calls (same as Node.js)
- Line 77-86: Handles async functions with finally() (same as Node.js)

C++ layer changes to support 'function' entry type:
- Added Type::Function to PerformanceEntry::Type enum (PerformanceEntry.h:57)
- Added 'function' parsing in parseEntryTypeString (PerformanceEntry.cpp:88-89)
- Added 'function' to supportedEntryTypes (PerformanceObserver.cpp:154)

Unlike Node.js which has 'function' only in JavaScript (observe.js:90),
Bun now has native C++ support for the 'function' entry type for better
performance and consistency with other entry types.

Tests: All 18 tests passing, covering sync/async functions, constructors,
error handling, and PerformanceObserver integration.

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-02 12:22:40 +00:00
Alistair Smith
31980bc151 perf_hooks.Histogram (#19920) 2025-05-26 21:18:22 -07:00
Meghan Denny
deeebf0538 node:perf_hooks: fixes 17716 (#17739) 2025-02-26 19:36:41 -08:00
Meghan Denny
b829590356 node: remove NotImplementedError exception in perf_hooks (#17651) 2025-02-24 22:10:22 -08:00
Jarred Sumner
2d65063571 Stub performance.markResourceTiming, add PerformanceResourceTiming, PerformanceServerTiming (#15341) 2024-11-22 14:14:05 -08:00
Jarred Sumner
cd6785771e run prettier and add back format action (#13722) 2024-09-03 21:32:52 -07:00
Jarred Sumner
3c785c88fb Fix issue with perf_hooks in canary (#8279)
* Update perf_hooks.ts

* Update perf_hooks.test.ts

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-19 05:22:06 -08:00
Jarred Sumner
a5e83189df Stub more of perf_hooks (#8239)
* Stub more of perf_hooks

* Update perf_hooks.ts

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2024-01-17 17:41:47 -08:00