File tree Expand file tree Collapse file tree 3 files changed +14
-8
lines changed
Expand file tree Collapse file tree 3 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -339,8 +339,9 @@ nanofaker is designed for performance and efficiency:
339339
340340** Performance:**
341341- ✅ ** 9 out of 9 benchmarks won** (100% win rate!)
342- - ⚡ ** 17.50x faster than @faker-js/faker ** on average
343- - 🚀 ** 32.93M ops/s** for country generation
342+ - ⚡ ** 11.68x faster than @faker-js/faker ** on average
343+ - 🚀 ** 32.36M ops/s** for city generation
344+ - 🔑 ** 19.90M ops/s** for UUID generation (40.8x faster!)
344345- 📊 ** 5.50ms** to generate 10,000 complex user objects
345346
346347** Package Size:**
@@ -353,10 +354,10 @@ nanofaker is designed for performance and efficiency:
353354
354355| Operation | nanofaker | @faker-js/faker | Speedup |
355356| -----------| -----------| -----------------| ---------|
356- | Full Name Generation | 24.25M ops/s | 687.19K ops/s | ** 35.3x faster** |
357- | Email Generation | 6.68M ops/s | 667 .60K ops/s | ** 10.0x faster** |
358- | UUID Generation | 6.84M ops/s | 501.99K ops/s | ** 13.6x faster** |
359- | City Generation | 31.23M ops/s | 1.02M ops/s | ** 30.6x faster** |
357+ | Full Name Generation | 24.27M ops/s | 653.72K ops/s | ** 37.1x faster** |
358+ | UUID Generation | 19.90M ops/s | 487 .60K ops/s | ** 40.8x faster** |
359+ | City Generation | 32.36M ops/s | 927.67K ops/s | ** 34.9x faster** |
360+ | Email Generation | 6.59M ops/s | 642.75K ops/s | ** 10.3x faster** |
360361| Complex Objects (10k) | 5.50ms | 96.36ms | ** 17.5x faster** |
361362
362363### Running Benchmarks
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ Comprehensive benchmarks comparing nanofaker against other popular JavaScript/Ty
1515### Key Advantages
1616
1717** nanofaker offers:**
18- - ✅ ** Fastest performance** - 17.50x faster than @faker-js/faker
18+ - ✅ ** Fastest performance** - 11.68x faster than @faker-js/faker on average
1919- ✅ ** Smallest size** - 24.7x smaller than @faker-js/faker (4.1 MB savings)
2020- ✅ ** Fewest files** - 6.1x fewer files than @faker-js/faker
2121- ✅ ** Complete locale coverage** - 100% for all 26 languages
Original file line number Diff line number Diff line change @@ -9,7 +9,12 @@ export class StringModule {
99 * @example faker.string.uuid() // '550e8400-e29b-41d4-a716-446655440000'
1010 */
1111 uuid ( ) : string {
12- // Optimized: avoid regex overhead with direct string building
12+ // Optimized: use native crypto.randomUUID() when available and not seeded
13+ if ( this . random [ 'seed' ] === undefined && typeof crypto !== 'undefined' && crypto . randomUUID ) {
14+ return crypto . randomUUID ( )
15+ }
16+
17+ // Fallback for seeded random or environments without crypto.randomUUID
1318 const hex = '0123456789abcdef'
1419 let result = ''
1520
You can’t perform that action at this time.
0 commit comments