Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Date JsonReviver5
(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 }); }
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):
It seems like you're sharing a JSON data string. Let me help you parse and extract insights from it. The provided data appears to be related to Chrome browser usage on Windows desktops, with different executions per second for various test names (e.g., "3", "7", etc.). If I were to summarize the key points: 1. The majority of tests are running at around 30-35 executions per second. 2. There is a significant drop in execution speed for test "9" and "11", both averaging around 24 seconds per second. 3. Test "5" has an average execution time of about 23 seconds per second, close to the top performers (tests "3" and "7"). 4. The lowest executing tests are "2", "6", and "10" with execution speeds under 15 seconds per second. Please let me know if you'd like me to extract any further insights or clarify anything!
Related benchmarks:
Date JsonReviver2
Date JsonReviver4
Date JsonReviver7
Date JsonReviver8
Comments
Confirm delete:
Do you really want to delete benchmark?