rfdc (Really Fast Deep Clone)
The fastest deep cloning library for JavaScript plain objects. 2-6x faster than lodash.cloneDeep and structuredClone for most object shapes. Zero dependencies. Supports circular references (with circular option), all primitive types, Dates, Arrays, and RegExp. Not designed for complex class instances — pure data object cloning.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Zero dependencies, MIT licensed. Local computation — no security concerns.
⚡ Reliability
Best When
You need maximum performance deep cloning of plain data objects (JSON-serializable structures with Dates) where structuredClone performance matters.
Avoid When
Your objects contain class instances, Maps, Sets, Symbols, or circular references by default — rfdc has limitations with these types.
Use Cases
- • Deep clone state objects in agent pipelines where performance-critical cloning is needed without mutation risk
- • Create isolated copies of configuration objects in agent middleware before modification
- • Clone large JSON API response objects before transformation in agent data processing pipelines
- • Implement fast copy-on-write patterns in agent state management where structuredClone overhead is measurable
- • Deep copy test fixtures and data structures in agent unit tests with minimal overhead
Not For
- • Cloning class instances with prototype methods — rfdc clones plain data only; use a class-aware clone for instances
- • Circular reference detection by default — must pass { proto: false, circles: true } option for circular structures
- • Map, Set, Symbol, or WeakMap/WeakRef types — rfdc handles plain objects, arrays, Date, and RegExp only
Interface
Authentication
Local library — no authentication required. MIT licensed.
Pricing
MIT licensed. Zero cost. Zero dependencies.
Agent Metadata
Known Gotchas
- ⚠ Circular references cause infinite recursion/stack overflow by default — must opt in: const clone = rfdc({ circles: true }) — forget this and crash on circular data
- ⚠ rfdc is a factory function — must call rfdc() first to get the clone function: const clone = rfdc(); const copy = clone(obj) — not a direct rfdc(obj) call
- ⚠ Does NOT clone Map, Set, Symbol, WeakMap — these types are copied by reference, not cloned; use structuredClone for these types
- ⚠ Class instances with prototype methods lose their prototype chain — cloned object is a plain object, not an instance: new Date() clones correctly but custom classes lose methods
- ⚠ Performance difference vs structuredClone only matters for frequent cloning — measure before optimizing; structuredClone is built-in and handles more types
- ⚠ proto option (default: false): { proto: true } copies prototype properties — rarely needed for data cloning; leave false for standard use
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for rfdc (Really Fast Deep Clone).
Scores are editorial opinions as of 2026-03-06.