Files
bun.sh/cmake/sources
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
..
2025-05-31 16:21:08 -07:00