fdu logo@pyyupsk/fdu - Faster Date-Time Utility

Benchmarks

Performance comparison of @pyyupsk/fdu against popular date manipulation libraries including Day.js, date-fns, and Luxon. Detailed benchmarks for parsing, formatting, manipulation operations, and bundle size comparisons.

@pyyupsk/fdu is designed to be lightweight and performant. Here's how it compares to other popular date libraries.

Bundle Size Comparison

LibraryMinifiedMinified + Gzipped
@pyyupsk/fdu9.0 KB3.13 KB
Day.js7.0 KB2.9 KB
date-fns~70 KB (full)~17 KB
Luxon256 KB~70 KB
Moment.js (deprecated)~290 KB~72 KB

Bundle sizes are approximate and may vary depending on which functions you import. @pyyupsk/fdu is tree-shakable, so you only pay for what you use.

Performance Benchmarks

Performance tests were run using Vitest Bench with Vitest 4.0.15 and Bun 1.3.3 on 2025-12-05.

Comprehensive Benchmark Results

Operation@pyyupsk/fduDay.jsdate-fnsLuxonSpeedup vs Day.js
Date Parsing2.88M ops/sec2.06M ops/sec134.1K ops/sec413.1K ops/sec1.40×
Date Formatting955.1K ops/sec548.7K ops/sec398.0K ops/sec626.1K ops/sec1.74×
Date Manipulation3.87M ops/sec965.2K ops/sec3.28M ops/sec449.1K ops/sec4.01×
Date Comparison20.17M ops/sec1.53M ops/sec4.92M ops/sec6.98M ops/sec13.18×
Complex Workflow549.8K ops/sec245.9K ops/sec415.5K ops/sec143.1K ops/sec2.24×
Batch Operations (100 dates)9.4K ops/sec5.3K ops/sec5.7K ops/sec2.8K ops/sec1.79×

What's Being Tested

  • Date Parsing: Parsing ISO 8601 date strings (2025-09-30T14:35:45.123Z)
  • Date Formatting: Formatting dates with pattern YYYY-MM-DD HH:mm:ss
  • Date Manipulation: Adding 1 day to a date
  • Date Comparison: Comparing two dates with isBefore()
  • Complex Workflow: Parse, format, and manipulate operations combined
  • Batch Operations: Creating and formatting 100 dates

date-fns uses parse() with format string, while Day.js and fdu support direct ISO string parsing.

Running Benchmarks Yourself

You can run the benchmarks yourself to verify the results:

# Clone the repository
git clone https://github.com/pyyupsk/fdu.git
cd fdu

# Install dependencies
bun install
# or
npm install

# Run benchmarks
bun run bench
# or
npm run bench

Methodology

All benchmarks were conducted using:

  • Hardware: Intel Core i5-12400, 10GB RAM, WSL2
  • Runtime: Bun 1.2+ / Node.js 22+
  • Framework: Vitest Bench (experimental benchmarking feature)
  • Test Data: ISO 8601 date strings (2025-09-30T14:35:45.123Z)
  • Iterations: Each test runs with multiple samples to ensure statistical significance
  • Warmup: Each benchmark includes a warmup phase to optimize JIT compilation
  • Libraries Tested:
    • @pyyupsk/fdu v0.0.0-beta.3
    • Day.js v1.11.18
    • date-fns v4.1.0
    • Luxon v3.7.2

Results may vary based on your hardware and runtime environment. Run the benchmarks yourself for accurate measurements on your system.

Key Takeaways

  1. Bundle Size: @pyyupsk/fdu (9.0 KB / 3.13 KB gzipped) is comparable to Day.js (7.0 KB / 2.9 KB), significantly smaller than Luxon (256 KB / ~70 KB) and date-fns (~70 KB full)
  2. Fastest Comparisons: Date comparison operations show the most dramatic speedup, making fdu ideal for sorting and filtering date collections
  3. Manipulation Speed: Adding/subtracting dates is significantly faster than Day.js and Luxon
  4. Consistent Performance: All operations benchmark faster than Day.js, with the table above showing exact speedups
  5. Day.js Compatible: Despite the performance gains, the API remains fully compatible with Day.js

@pyyupsk/fdu provides excellent performance while maintaining a small bundle size, making it ideal for both client-side and server-side applications.

Real-World Performance

Beyond synthetic benchmarks, @pyyupsk/fdu's immutable design and minimal overhead make it particularly efficient for:

  • Server-side rendering - Fast date formatting for timestamps and logs
  • Data processing - Efficient batch processing of date operations
  • Client applications - Small bundle size improves initial load times
  • Real-time apps - Low overhead for frequent date updates

See Also

On this page