@@ -125,62 +125,70 @@ filesize.js is optimized for high performance with comprehensive benchmarks cove
125125
126126| Scenario | Operations/sec | Notes |
127127| ----------| ----------------| -------|
128- | ** Basic conversion** | ~ 10-12M ops/sec | Fastest operations (small numbers) |
129- | ** Large numbers** | ~ 10-11M ops/sec | Consistent performance |
130- | ** With options** | ~ 4-9M ops/sec | Depends on option complexity |
131- | ** Locale formatting** | ~ 85K ops/sec | Most expensive operation |
132- | ** Partial functions ** | ~ 6-8M ops/sec | ~ 10-20% overhead, amortized |
128+ | ** Basic conversion** | ~ 16-27M ops/sec | Fastest operations (large numbers) |
129+ | ** Small numbers** | ~ 18-20M ops/sec | Consistent performance |
130+ | ** With options** | ~ 5-13M ops/sec | Depends on option complexity |
131+ | ** Locale formatting** | ~ 91K ops/sec | Most expensive operation |
132+ | ** Stress testing ** | ~ 2-10M ops/sec | Handles edge cases gracefully |
133133
134134### 📊 Detailed Benchmark Results
135135
136- #### Basic Performance (5-run average, excluding outliers )
137- - ** filesize(0)** : 10.1M ops/sec
138- - ** filesize(512)** : 12 .3M ops/sec
139- - ** filesize(1024)** : 10.2M ops/sec
140- - ** filesize(1MB)** : 11.3M ops/sec
141- - ** filesize(1GB)** : 11.1M ops/sec
142- - ** With bits=true ** : 9.3M ops/sec
143- - ** With standard="iec" ** : 9.6M ops/sec
144- - ** With fullform=true ** : 4.4M ops/sec
145- - ** Object output ** : 5.1M ops/sec
136+ #### Basic Performance (5-run average)
137+ - ** filesize(0)** : 18.6M ops/sec
138+ - ** filesize(512)** : 20 .3M ops/sec
139+ - ** filesize(1024)** : 18.7M ops/sec
140+ - ** filesize(1MB)** : 23.5M ops/sec
141+ - ** filesize(1GB)** : 23.6M ops/sec
142+ - ** filesize(1TB) ** : 26.9M ops/sec
143+ - ** With bits=true ** : 16.8M ops/sec
144+ - ** With standard="iec" ** : 16.6M ops/sec
145+ - ** With round=4 ** : 13.4M ops/sec
146146
147147#### Options Performance Impact
148- - ** Default options** : 6.4M ops/sec (baseline)
149- - ** bits=true** : 1.66x slower
150- - ** pad=true** : 2.74x slower
151- - ** locale="en-US"** : 75x slower (significant overhead)
152- - ** standard="iec"** : 1.12x slower
153- - ** output="object"** : 0.96x faster
154- - ** Complex combinations** : 1.6-2.1x slower
148+ - ** bits=true** : 12.5M ops/sec
149+ - ** pad=true** : 5.6M ops/sec
150+ - ** locale="en-US"** : 91K ops/sec (significant overhead)
151+ - ** standard="iec"** : 8.8M ops/sec
152+ - ** standard="jedec"** : 9.0M ops/sec
153+ - ** output="array"** : 10.2M ops/sec
154+ - ** output="object"** : 9.2M ops/sec
155+ - ** fullform=true** : 7.8M ops/sec
156+ - ** precision=3** : 6.3M ops/sec
157+ - ** separator=","** : 7.2M ops/sec
155158
156159#### Stress Test Results
157- - ** Edge cases** : 2.0M ops/sec (90% success rate)
158- - ** Very large numbers** : 3.7M ops/sec (100% success)
159- - ** BigInt values** : 2.8M ops/sec (100% success)
160- - ** Memory pressure** : 48K ops/sec (100% success)
161- - ** Performance consistency** : 84.7% (10 runs average)
160+ - ** Edge cases** : 2.3M ops/sec (90% success rate)
161+ - ** Very large numbers** : 4.6M ops/sec (100% success)
162+ - ** Very small numbers** : 10.4M ops/sec (100% success)
163+ - ** Negative numbers** : 5.4M ops/sec (100% success)
164+ - ** Random options** : 2.3M ops/sec (100% success)
165+ - ** BigInt values** : 3.7M ops/sec (100% success)
166+ - ** Memory pressure** : 49K ops/sec (100% success)
167+ - ** Error conditions** : 715K ops/sec (~ 40% success rate)
162168
163169#### Partial Function Performance
164- - ** Direct calls ** : 8.0M ops/sec (baseline)
165- - ** Simple partial ** : 6.7M ops/sec (1.20x slower)
166- - ** Complex partial ** : 5.6M ops/sec (1.42x slower)
167- - ** Partial with locale ** : 84K ops/sec (95x slower)
170+ Partial functions maintain excellent performance with minimal overhead:
171+ - ** Acceptable overhead ** : 1.1-1.4x slower for most configurations
172+ - ** Locale partials ** : Significant overhead ( ~ 180x slower) due to locale formatting
173+ - ** Creation cost ** : Amortized across multiple uses
168174
169175### 💡 Performance Insights
170176
171- ** Excellent Performance (>1M ops/sec)**
177+ ** Excellent Performance (>10M ops/sec)**
172178- Basic conversions with minimal options
179+ - Large number processing (1TB+ values)
173180- Standard output formats (string, array, object)
174181- IEC and JEDEC standards
175182
176- ** Good Performance (100K-1M ops/sec)**
183+ ** Good Performance (1-10M ops/sec)**
177184- Complex option combinations
178185- Precision and rounding operations
179186- Fullform output
187+ - Stress test scenarios
180188
181189** Use Sparingly (<100K ops/sec)**
182- - Locale formatting (significant overhead)
183- - Complex locale configurations
190+ - Locale formatting (significant overhead ~ 91K ops/sec )
191+ - Memory pressure conditions
184192
185193### 🎯 Optimization Tips
186194
@@ -215,7 +223,7 @@ The latest version includes significant performance improvements:
215223
216224** Overall performance improvement: 30-70% faster** across common use cases while maintaining full backward compatibility.
217225
218- * Benchmarks run on macOS ARM64, Node.js v23.10 .0, 12 CPU cores, 24GB RAM*
226+ * Benchmarks run on macOS ARM64, Node.js v24.8 .0, 12 CPU cores, 24GB RAM (5-run averages) *
219227
220228## API Reference
221229
@@ -447,23 +455,61 @@ filesize.js/
4474556 . Push to the branch (` git push origin feature/amazing-feature ` )
4484567 . Open a Pull Request
449457
458+ ### Development Workflow
459+
460+ filesize.js includes an optimized development workflow with modern build tools:
461+
462+ * ** 🔄 Live Reload** : Use ` npm run dev ` for automatic rebuilds during development
463+ * ** 📊 Bundle Analysis** : Monitor build sizes with ` npm run build:analyze `
464+ * ** ⚡ Fast Testing** : Live test running with ` npm run test:watch `
465+ * ** 🔧 Auto-fixing** : Automatic linting fixes with ` npm run lint:fix `
466+ * ** 📈 Performance** : Optimized Rollup configuration with enhanced tree shaking
467+
468+ ** Build Output Analysis:**
469+ - Minified ES Module: ~ 1.8KB (gzipped)
470+ - UMD Bundle: ~ 1.9KB (gzipped)
471+ - Comprehensive source maps included
472+
450473### Development Commands
451474
452475``` bash
453476# Install dependencies
454477npm install
455478
479+ # Development mode with live rebuild
480+ npm run dev
481+
482+ # Build distribution
483+ npm run build
484+
485+ # Build with bundle size analysis
486+ npm run build:analyze
487+
488+ # Live rebuild during development
489+ npm run build:watch
490+
456491# Run linting
457492npm run lint
458493
494+ # Auto-fix linting issues
495+ npm run lint:fix
496+
459497# Run tests
460498npm test
461499
462- # Build distribution
463- npm run build
500+ # Live testing during development
501+ npm run test:watch
502+
503+ # Run only unit tests
504+ npm run mocha
505+
506+ # Bundle size analysis
507+ npm run analyze:size
464508
465- # Run all checks (lint + test)
466- npm run ci
509+ # Benchmarking
510+ npm run benchmark
511+ npm run benchmark:basic
512+ npm run benchmark:stress
467513```
468514
469515## License
0 commit comments