Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
sorting algorithm check
(version: 0)
Comparing performance of:
Previous vs MyOwn
Created:
6 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
searchResults = [ { county: "Adair", state: "Oklahoma", "region-type": "county", kind: "county", id: "-iYA92cBn26Nb0KrJNh5" }, { meridian: "IM", county: "Adair", range: "24E", state: "Oklahoma", "region-type": "township", township: "16N", kind: "township", id: "HCkd92cBn26Nb0KrKubx" }, { meridian: "IM", county: "Adair", range: "25E", state: "Oklahoma", "region-type": "township", township: "17N", kind: "township", id: "0Ckd92cBn26Nb0KrKuXx" }, { meridian: "IM", county: "Adair", range: "25E", state: "Oklahoma", "region-type": "township", township: "15N", kind: "township", id: "WSkd92cBn26Nb0KrKubx" }, { meridian: "IM", county: "Adair", range: "26E", state: "Oklahoma", "region-type": "township", township: "18N", kind: "township", id: "oCkd92cBn26Nb0KrKuXx" }, { meridian: "IM", county: "Adair", range: "27E", state: "Oklahoma", "region-type": "township", township: "15N", kind: "township", id: "Yykd92cBn26Nb0KrKubx" }, { meridian: "IM", county: "Adair", range: "25E", state: "Oklahoma", "region-type": "township", township: "19N", kind: "township", id: "bCkd92cBn26Nb0KrKuXx" }, { meridian: "IM", county: "Adair", range: "24E", state: "Oklahoma", "region-type": "township", township: "18N", kind: "township", id: "pikd92cBn26Nb0KrKuXx" }, { meridian: "IM", county: "Adair", range: "24E", state: "Oklahoma", "region-type": "township", township: "14N", kind: "township", id: "fykd92cBn26Nb0KrKubx" }, { meridian: "IM", county: "Adair", range: "27E", state: "Oklahoma", "region-type": "township", township: "14N", kind: "township", id: "gikd92cBn26Nb0KrKubx" }, { meridian: "IM", county: "Adair", range: "25E", state: "Oklahoma", "region-type": "township", township: "14N", kind: "township", id: "kSkd92cBn26Nb0KrKubx" }, { meridian: "IM", county: "Adair", range: "25E", section: "17", state: "Oklahoma", "region-type": "section", township: "18N", kind: "section", id: "PCkZ92cBn26Nb0KrfDOO" }, { meridian: "IM", county: "Adair", range: "25E", section: "16", state: "Oklahoma", "region-type": "section", township: "16N", kind: "section", id: "PCkZ92cBn26Nb0KrfEKa" }, { meridian: "IM", county: "Adair", range: "24E", section: "23", state: "Oklahoma", "region-type": "section", township: "16N", kind: "section", id: "PCkZ92cBn26Nb0KrfEOb" }, { meridian: "IM", county: "Adair", range: "26E", section: "16", state: "Oklahoma", "region-type": "section", township: "18N", kind: "section", id: "PSkZ92cBn26Nb0KrfDOO" }, { meridian: "IM", county: "Adair", range: "26E", section: "19", state: "Oklahoma", "region-type": "section", township: "14N", kind: "section", id: "PSkZ92cBn26Nb0KrfFKk" }, { meridian: "IM", county: "Adair", range: "24E", section: "20", state: "Oklahoma", "region-type": "section", township: "19N", kind: "section", id: "PikX92cBn26Nb0KrTS2_" }, { meridian: "IM", county: "Adair", range: "24E", section: "06", state: "Oklahoma", "region-type": "section", township: "16N", kind: "section", id: "PikZ92cBn26Nb0KrfD-Y" }, { meridian: "IM", county: "Adair", range: "26E", section: "05", state: "Oklahoma", "region-type": "section", township: "16N", kind: "section", id: "QSkZ92cBn26Nb0KrfD-Y" } ]
Tests:
Previous
const createTownshipSortString = function( region, existingSort ) { // Unique case, always put CM meridian at bottom. const meridian = region.meridian === 'CM' ? 'Z' : region.meridian; return ( existingSort + meridian + region.county + region.township + region.range ); } const sortResults = function(searchResults) { return _.sortBy(searchResults, result => { // Sort counties at top. const regionSort = result.kind === 'county' ? '1' : '3'; const townshipSort = result.kind === 'township' ? '2' : '3'; const sortStr = `${regionSort}${townshipSort}`; switch (result.kind) { case 'survey': return ( sortStr + result.county + result.survey + result.block + result.section + result.abstract ); case 'county': return sortStr; case 'township': return createTownshipSortString(result, sortStr); case 'section': return createTownshipSortString(result, sortStr) + result.section; } }); } sortResults(searchResults)
MyOwn
const sortResults2 = function(searchResults) { const groupedResults = _.groupBy(searchResults, 'kind'); const concatedArrays = [...groupedResults.county, ...groupedResults.township, ...(_.orderBy(groupedResults.section, 'section', 'asc'))]; return concatedArrays; } sortResults2(searchResults)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Previous
MyOwn
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 provide an answer. It seems like we have three main components here: 1. A JSON object with two objects: one for a section of land in Oklahoma and another for a town in the UK. 2. Two benchmark definitions (in JavaScript) that are supposed to sort a list of search results. One definition uses Lodash's `sortBy` function, while the other defines its own sorting algorithm using a `createTownshipSortString` function. 3. A benchmark result object with two entries, each containing information about a Chrome 75 browser execution on a Mac OS X 10.14.3 machine. Given these components, I'm going to take an educated guess that the task is to analyze the benchmark results and determine which sorting algorithm (MyOwn or Previous) performs better in terms of executions per second. To do this, I would extract the `ExecutionsPerSecond` values from each benchmark result object: * For "Previous": 259350.203125 * For "MyOwn": 97233.5625 Then, I would compare these values to determine which sorting algorithm is faster. Based on the numbers, it appears that the previous algorithm (Not My Own) performs significantly better than the custom algorithm (My Own). Is that correct?
Related benchmarks:
Find item in large array - Fork
lodash_array_objects
lodash_array_objects_2
Test-BC
_.isEqual vs JSON.stringify big
Comments
Confirm delete:
Do you really want to delete benchmark?