Skip to content

Commit ecf6b0c

Browse files
committed
Updating README.md benchmarks
1 parent b77d0c9 commit ecf6b0c

File tree

1 file changed

+44
-36
lines changed

1 file changed

+44
-36
lines changed

README.md

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -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

0 commit comments

Comments
 (0)