Changeset: b4c6c1b1e767 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b4c6c1b1e767
Modified Files:
        gdk/gdk_search.c
Branch: default
Log Message:

Shortcut in SORTfnd* for searching in dense column.


diffs (22 lines):

diff --git a/gdk/gdk_search.c b/gdk/gdk_search.c
--- a/gdk/gdk_search.c
+++ b/gdk/gdk_search.c
@@ -459,6 +459,18 @@ SORTfndwhich(BAT *b, const void *v, int 
        if (b == NULL || (!b->tsorted && !b->trevsorted))
                return BUN_NONE;
 
+       if (BATtdense(b)) {
+               /* no need for binary search on dense column */
+               if (* (const oid *) v < b->tseqbase)
+                       return which == 0 ? BUN_NONE : lo;
+               if (* (const oid *) v >= b->tseqbase + BATcount(b))
+                       return which == 0 ? BUN_NONE : hi;
+               cur = (BUN) (* (const oid *) v - b->tseqbase) + lo;
+               if (which > 0)
+                       cur++;
+               return cur;
+       }
+
        if (which < 0) {
                end = lo;
                if (lo >= hi || (b->tsorted ? atom_GE(BUNtail(bi, lo), v, 
b->ttype) : atom_LE(BUNtail(bi, lo), v, b->ttype))) {
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to