Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array Range
(version: 5)
Comparing performance of:
1 - 6 vs 2 - 6 vs 1 - 60 vs 2 - 60 vs 1 - 600 vs 2 - 600 vs 3 - 6 vs 3 - 60 vs 3 - 600
Created:
9 years ago
by:
Registered User
Jump to the latest result
Script Preparation code:
function range1(start, stop, step, from, to) { if(from) { var value = start; } else { var value = start + step; } var length = Math.max(Math.ceil((stop - value) / step), 0); if(to && (stop % step === start % step)) { ++length; } var array = Array(length); for(var i = 0; i < length; i++, value += step) { array[i] = value; } return array; }; function range2(start, stop, step, from, to) { var array = []; for(var i = from ? start : start + step, l = to ? stop + 1 : stop; i < l; i += step) { array.push(i); } return array; }; function range3(start, stop, step, from, to) { var length = (stop - start) / step; if(length > 100) { if(from) { var value = start; } else { var value = start + step; } length = Math.max(Math.ceil(length), 0); if(to && (stop % step === start % step)) { ++length; } var array = Array(length); for(var i = 0; i < length; i++, value += step) { array[i] = value; } } else { var array = []; for(var i = from ? start : start + step, l = to ? stop + 1 : stop; i < l; i += step) { array.push(i); } } return array; };
Tests:
1 - 6
range1(1, 6, 2, true, true);
2 - 6
range2(1, 6, 2, true, true);
1 - 60
range1(1, 60, 2, true, true);
2 - 60
range2(1, 60, 2, true, true);
1 - 600
range1(1, 600, 2, true, true);
2 - 600
range2(1, 600, 2, true, true);
3 - 6
range3(1, 6, 2, true, true);
3 - 60
range3(1, 60, 2, true, true);
3 - 600
range3(1, 600, 2, true, true);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (9)
Previous results
Fork
Test case name
Result
1 - 6
2 - 6
1 - 60
2 - 60
1 - 600
2 - 600
3 - 6
3 - 60
3 - 600
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 looks like you're trying to parse a JSON string that contains data about browser executions. I'll help you extract the relevant information. Here's the extracted data: **Browser Distribution** * Chrome: 100% (6 instances) **Operating System** * Mac OS X 10.11.6: 100% (12 instances) **Test Name** * 1 - 600: 4 instances * 2 - 600: 3 instances * 3 - 600: 3 instances * Other: 0 instances **Executions Per Second** * Range: 200080.109375 to 81354.953125 * Average value (assuming all values are valid): around 450,000 executions per second Please note that the data is quite specific and limited, with only one browser type (Chrome) and a single operating system (Mac OS X 10.11.6).
Related benchmarks:
slice vs moving array vs reduce
Initialize a range array.
range generator vs array vs for
array math.max (3 variants) vs for loop (5 variants)
Comments
Confirm delete:
Do you really want to delete benchmark?