A comprehensive performance benchmark tool for evaluating Day.js timezone conversion operations. This project measures and compares the efficiency of converting UTC timestamps to various timezones using Day.js with the timezone plugin.
This benchmark helps developers understand the performance characteristics of Day.js timezone operations, which is crucial for applications that handle multiple timezones or require high-frequency time conversions.
- Performance Testing: Measures execution time for timezone conversions
- Multiple Timezone Support: Tests against various timezone scenarios
- Statistical Analysis: Provides detailed performance metrics
- Easy Setup: Simple installation and execution process
- Configurable: Customizable benchmark parameters
- Runtime: Node.js v22.14.0+
- Timezone Library: Day.js v1.11.x with timezone plugin
- Testing Framework: Built-in Node.js performance measurement
- Platform: Cross-platform (tested on macOS, Linux, Windows)
-
Clone the repository:
git clone https://github.com/devendrafyle/timezone-benchmark.git cd timezone-benchmark -
Install dependencies:
npm install
-
Install Day.js (if not already installed):
npm install dayjs
The benchmark supports two modes with various options:
# Show help
node benchmark.js --help
# Run advanced benchmark (default - comprehensive output)
node benchmark.js
node benchmark.js --advanced
# Run basic benchmark (simple output like original)
node benchmark.js --basic
node benchmark.js -b
# Basic benchmark with custom timezone
node benchmark.js --basic --timezone UTC
node benchmark.js -b -t America/New_YorkSimple output format similar to the original benchmark:
node benchmark.js --basicOutput:
🔄 Running Basic Benchmark for Asia/Kolkata...
List Size: 10 | Avg Time: 1.35 ms | Per-Item: 0.14 ms
List Size: 100 | Avg Time: 3.98 ms | Per-Item: 0.04 ms
List Size: 1000 | Avg Time: 36.85 ms | Per-Item: 0.04 ms
✅ Basic benchmark completed!
Comprehensive benchmarking with detailed statistics:
node benchmark.js --advancedFeatures:
- Multiple timezone testing
- Detailed performance metrics
- Memory usage tracking
- Statistical analysis
- Performance summary
The benchmark provides detailed metrics including:
- Execution Time: Average, minimum, and maximum conversion times
- Memory Usage: Heap usage during operations
- Throughput: Conversions per second
- Statistical Analysis: Standard deviation and percentiles
Day.js Timezone Conversion Benchmark
====================================
Converting 10000 timestamps to America/New_York:
- Average time: 0.045ms
- Min time: 0.032ms
- Max time: 0.089ms
- Total time: 450.23ms
- Throughput: 22,222 conversions/sec
- UTC to timezone conversion performance
- Memory allocation patterns
- CPU usage during operations
- Scalability with different data sizes
- Timezone plugin overhead
- First Run: Initial conversions may be slower due to JIT compilation
- Memory: Large datasets may impact performance
- Timezone Complexity: Some timezones have more complex rules
- Platform Differences: Performance may vary across operating systems
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Ensure all tests pass
- Add appropriate documentation
- Follow existing code style
- Include performance impact analysis for new features
This project is licensed under the MIT License - see the LICENSE file for details.
- Day.js team for the excellent timezone library
- Node.js community for performance measurement tools
- Contributors and users who provide feedback
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Wiki: Project Wiki
Note: This benchmark is designed for development and testing purposes. You can always test performance in your specific use case and environment.