Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Date JsonReviver7
(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 vs 14
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 }); input.push({ key: 'a', value: Math.random() }); input.push({ key: 'b', value: Math.random() }); input.push({ key: 'c', value: Math.random() }); input.push({ key: 'd', value: Math.random() }); input.push({ key: 'e', value: Math.random() }); }
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; } });
14
const result = input.map(x=>{ switch (x.key){ case 'businessDate': case 'startDate': case 'endDate': case 'updatedAt': if (typeof x.value === 'string'){ return new Date(x.value); } return x.value; break; default: return x.value; break; } });
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (14)
Previous results
Fork
Test case name
Result
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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):
Let's dive into the data! Based on the provided JSON object, I can extract some insights: 1. **Browser and Version**: All samples have Chrome 103 as their browser version. 2. **Device Platform**: The device platform is consistently set to "Desktop" for all samples. 3. **Operating System**: The operating system is Windows across all samples. 4. **Execution Speeds**: The execution per second (ExecutionsPerSecond) values vary greatly among the samples, ranging from 5.783865928649902 to 24.903154373168945. It appears that these samples may be related to a benchmarking or performance testing scenario, where Chrome's execution speed on Windows desktops is being evaluated under different conditions. Would you like me to help with anything else?
Related benchmarks:
Date JsonReviver2
Date JsonReviver4
Date JsonReviver5
Date JsonReviver8
Comments
Confirm delete:
Do you really want to delete benchmark?