Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Date JsonReviver4
(version: 0)
Comparing performance of:
1 vs 2 vs 3 vs 4 vs 5 vs 6 vs 7 vs 8 vs 9 vs 10 vs 11 vs 12 vs 13
Created:
3 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var input = []; for (i = 2; i <= 100000; i++) { const date = new Date(Math.random()*1000); const value = i % 2 === 0 ? date.toISOString() : 'some random value'; const key = i % 2 === 0 ? 'businessDate' : 'some random key'; input.push({ key, value }); input.push({ key: 'index', value: i }); input.push({ key: 'updatedAt', value: i }); }
Tests:
1
const result = input.map(x=>{ if ( typeof x.value === 'string' && (x.key === 'businessDate' || x.key=== 'startDate' || x.key === 'endDate' || x.key === 'updatedAt') ) { return new Date(x.value); } return x.value; });
2
const result = input.map(x=>{ if (typeof x.value === 'string') { const date = new Date(x.value); return isNaN(date) ? x.value : date; } return x.value; });
3
const result = input.map(x=>{ if (x.key.endsWith('Date') && typeof x.value === 'string') { return new Date(x.value); } return x.value; });
4
const result = input.map(x=>{ if (typeof x.value === 'string' && /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/.test(x.value)) { return new Date(x.value); } return x.value; });
5
const result = input.map(x=>{ if (/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/.test(x.value)) { return new Date(x.value); } return x.value; });
6
const dateFields = ['businessDate', 'startDate', 'endDate', 'updatedAt'] const result = input.map(x=>{ if (dateFields.includes(x.key)) { return new Date(x.value); } return x.value; });
7
const dateFields = ['businessDate', 'startDate', 'endDate', 'updatedAt'] const result = input.map(x=>{ if (dateFields.includes(x.key) && typeof x.value === 'string') { return new Date(x.value); } return x.value; });
8
const dateFields = new Set(['businessDate', 'startDate', 'endDate', 'updatedAt']); const result = input.map(x=>{ if (dateFields.has(x.key) && typeof x.value === 'string') { return new Date(x.value); } return x.value; });
9
const dateFields = ['businessDate', 'startDate', 'endDate', 'updatedAt'] const result = input.map(x=>{ if (dateFields.includes(x.key) && typeof x.value === 'string') { const date = new Date(x.value); return isNaN(date) ? x.Value : date; } return x.value; });
10
const dateFields = ['businessDate', 'startDate', 'endDate', 'updatedAt'] const result = input.map(x=>{ if (dateFields.includes(x.key) && typeof x.value === 'string' && /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/.test(x.value)) { return new Date(x.value); } return x.value; });
11
const dateFields = ['businessDate', 'startDate', 'endDate', 'updatedAt'] const result = input.map(x=>{ if (dateFields.includes(x.key) && /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/.test(x.value)) { return new Date(x.value); } return x.value; });
12
const result = input.map(x=>{ if (typeof x.value !== 'string'){ return x.value; } if (x.key === 'businessDate' || x.key=== 'startDate' || x.key === 'endDate' || x.key === 'updatedAt' ){ return new Date(x.value); } return x.value; });
13
const result = input.map(x=>{ if (typeof x.value !== 'string'){ return x.value; } switch (x.key){ case 'businessDate': case 'startDate': case 'endDate': case 'updatedAt': return new Date(x.value); break; default: return x.value; break; } });
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (13)
Previous results
Fork
Test case name
Result
1
2
3
4
5
6
7
8
9
10
11
12
13
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
I'll do my best to extract insights from the provided JSON data. **Key observations:** 1. **Most devices are running Chrome 99**: Out of 12 tests, 9 test cases have a browser version of "Chrome 99". 2. **Windows dominates the operating system**: All 12 test cases report Windows as the operating system. 3. **Device platforms**: While Chrome is consistently reported, the exact device platform (e.g., Desktop or Mobile) is not specified in all test cases. 4. **Execution rates vary widely**: The execution rate per second ("ExecutionsPerSecond") varies significantly across tests, from 15.13175106048584 to 34.381858825683594. **Open questions:** 1. What are the exact device platforms being used (e.g., Desktop or Mobile)? 2. Are there any correlations between browser version and execution rates? If you'd like me to help with anything else, feel free to ask!
Related benchmarks:
Date JsonReviver2
Date JsonReviver5
Date JsonReviver7
Date JsonReviver8
Comments
Confirm delete:
Do you really want to delete benchmark?