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
| Library | Minified | Minified + Gzipped |
|---|---|---|
| @pyyupsk/fdu | 9.0 KB | 3.13 KB |
| Day.js | 7.0 KB | 2.9 KB |
| date-fns | ~70 KB (full) | ~17 KB |
| Luxon | 256 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/fdu | Day.js | date-fns | Luxon | Speedup vs Day.js |
|---|---|---|---|---|---|
| Date Parsing | 2.88M ops/sec | 2.06M ops/sec | 134.1K ops/sec | 413.1K ops/sec | 1.40× |
| Date Formatting | 955.1K ops/sec | 548.7K ops/sec | 398.0K ops/sec | 626.1K ops/sec | 1.74× |
| Date Manipulation | 3.87M ops/sec | 965.2K ops/sec | 3.28M ops/sec | 449.1K ops/sec | 4.01× |
| Date Comparison | 20.17M ops/sec | 1.53M ops/sec | 4.92M ops/sec | 6.98M ops/sec | 13.18× |
| Complex Workflow | 549.8K ops/sec | 245.9K ops/sec | 415.5K ops/sec | 143.1K ops/sec | 2.24× |
| Batch Operations (100 dates) | 9.4K ops/sec | 5.3K ops/sec | 5.7K ops/sec | 2.8K ops/sec | 1.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 benchMethodology
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
- 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) - Fastest Comparisons: Date comparison operations show the most dramatic speedup, making fdu ideal for sorting and filtering date collections
- Manipulation Speed: Adding/subtracting dates is significantly faster than Day.js and Luxon
- Consistent Performance: All operations benchmark faster than Day.js, with the table above showing exact speedups
- 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
- Installation - Get started with @pyyupsk/fdu
- API Reference - Complete API documentation