MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / linearSearch

Function linearSearch

web/pgadmin/browser/static/js/browser.js:577–595  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

575 items = __ctx.t.children(__ctx.i),
576 s = 0, e = items.length - 1, i,
577 linearSearch = function() {
578 while (e >= s) {
579 i = items[s];
580 let d = __ctx.t.itemData(i);
581 if (d._type === 'column') {
582 if (pgAdmin.numeric_comparator(d._id, _data._id) == 1)
583 return true;
584 } else if (pgAdmin.natural_sort(d._label, _data._label) == 1)
585 return true;
586 s++;
587 }
588 //when the current element is greater than the end element
589 if (e != items.length - 1) {
590 i = items[e+1];
591 return true;
592 }
593 i = null;
594 return false;
595 },
596 binarySearch = function() {
597 let d, m;
598 // Binary search only outperforms Linear search for n > 44.

Callers 1

binarySearchFunction · 0.85

Calls 1

itemDataMethod · 0.65

Tested by

no test coverage detected