Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
pre-sorted sorting (int vs obj)
(version: 1)
Comparing performance of:
pre sorted int vs reverse int vs shuffled int vs pre sorted obj vs reverse obj vs shuffled obj
Created:
7 years ago
by:
Registered User
Jump to the latest result
Script Preparation code:
function shuffle_arr(arr) { const a = [...arr]; for (let i = a.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [a[i], a[j]] = [a[j], a[i]]; } return a; } var pre_sorted_int = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100]; var reverse_int = pre_sorted_int.reverse(); var shuffled_int = shuffle_arr(pre_sorted_int); var pre_sorted_obj = [{"id":"0"},{"id":"1"},{"id":"2"},{"id":"3"},{"id":"4"},{"id":"5"},{"id":"6"},{"id":"7"},{"id":"8"},{"id":"9"},{"id":"a"},{"id":"b"},{"id":"c"},{"id":"d"},{"id":"e"},{"id":"f"},{"id":"10"},{"id":"11"},{"id":"12"},{"id":"13"},{"id":"14"},{"id":"15"},{"id":"16"},{"id":"17"},{"id":"18"},{"id":"19"},{"id":"1a"},{"id":"1b"},{"id":"1c"},{"id":"1d"},{"id":"1e"},{"id":"1f"},{"id":"20"},{"id":"21"},{"id":"22"},{"id":"23"},{"id":"24"},{"id":"25"},{"id":"26"},{"id":"27"},{"id":"28"},{"id":"29"},{"id":"2a"},{"id":"2b"},{"id":"2c"},{"id":"2d"},{"id":"2e"},{"id":"2f"},{"id":"30"},{"id":"31"},{"id":"32"},{"id":"33"},{"id":"34"},{"id":"35"},{"id":"36"},{"id":"37"},{"id":"38"},{"id":"39"},{"id":"3a"},{"id":"3b"},{"id":"3c"},{"id":"3d"},{"id":"3e"},{"id":"3f"},{"id":"40"},{"id":"41"},{"id":"42"},{"id":"43"},{"id":"44"},{"id":"45"},{"id":"46"},{"id":"47"},{"id":"48"},{"id":"49"},{"id":"4a"},{"id":"4b"},{"id":"4c"},{"id":"4d"},{"id":"4e"},{"id":"4f"},{"id":"50"},{"id":"51"},{"id":"52"},{"id":"53"},{"id":"54"},{"id":"55"},{"id":"56"},{"id":"57"},{"id":"58"},{"id":"59"},{"id":"5a"},{"id":"5b"},{"id":"5c"},{"id":"5d"},{"id":"5e"},{"id":"5f"},{"id":"60"},{"id":"61"},{"id":"62"},{"id":"63"}]; var reverse_obj = pre_sorted_obj.reverse(); var shuffled_obj = shuffle_arr(pre_sorted_obj); var obj_sorter = (a,b) => { if (a.id < b.id) { return -1; } if (a.id > b.id) { return 1; } return 0; }
Tests:
pre sorted int
const sorted = pre_sorted_int.sort();
reverse int
const sorted = reverse_int.sort();
shuffled int
const sorted = shuffled_int.sort()
pre sorted obj
const sorted = pre_sorted_obj.sort(obj_sorter);
reverse obj
const sorted = reverse_obj.sort(obj_sorter);
shuffled obj
const sorted = shuffled_obj.sort(obj_sorter);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (6)
Previous results
Fork
Test case name
Result
pre sorted int
reverse int
shuffled int
pre sorted obj
reverse obj
shuffled obj
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 appears that we have a series of benchmarking tests to analyze. The objective is to determine which test case has the highest Execution Per Second (EPS) value. To answer this question, I will examine each test case individually: 1. **pre sorted int**: EPS = 63477.50390625 2. **reverse int**: EPS = 63936.02734375 3. **shuffled int**: EPS = 72037.453125 4. **pre sorted obj**: EPS = 78871.515625 5. **reverse obj**: EPS = 89025.984375 6. **shuffled obj**: EPS = 92697.5 Based on the EPS values, it appears that the **shuffled obj** test case has the highest value, with an EPS of approximately 92.698 kg (I assume you meant "per second" instead of "per kilogram"). Therefore, my answer is: **The shuffled obj test case has the highest Execution Per Second value.**
Related benchmarks:
Already sorted versus random
Array Sorting Methods
pre-sorted sorting
Sort method comparisons (quicksort, for loop, Arra.prototype.sort)
Comments
Confirm delete:
Do you really want to delete benchmark?